Increase allowed nesting level to 15
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 86c62bb..12be915 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -611,8 +611,11 @@
return(nReturn);
}
-
-static uint8_t spTooDeepArrays[] = {0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x80};
+// Big enough to test nesting to the depth of 24
+static uint8_t spTooDeepArrays[] = {0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x80};
int ParseTooDeepArrayTest()
{
@@ -624,7 +627,7 @@
QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spTooDeepArrays), QCBOR_DECODE_MODE_NORMAL);
- for(i = 0; i < 10; i++) {
+ for(i = 0; i < QCBOR_MAX_ARRAY_NESTING1; i++) {
if(QCBORDecode_GetNext(&DCtx, &Item) != 0 ||
Item.uDataType != QCBOR_TYPE_ARRAY ||
diff --git a/test/qcbor_encode_tests.c b/test/qcbor_encode_tests.c
index b42002e..395e43a 100644
--- a/test/qcbor_encode_tests.c
+++ b/test/qcbor_encode_tests.c
@@ -1637,26 +1637,28 @@
QCBOREncode_Init(&EC, UsefulBuf_FROM_BYTE_ARRAY(spBigBuf));
// ---- Make a complicated nested CBOR structure ---
- QCBOREncode_OpenArray(&EC);
+#define BSTR_TEST_DEPTH 10
- for(int i = 0; i < QCBOR_MAX_ARRAY_NESTING-2; i++) {
+ QCBOREncode_OpenArray(&EC);
+
+ for(int i = 0; i < BSTR_TEST_DEPTH-2; i++) {
QCBOREncode_BstrWrap(&EC);
QCBOREncode_AddUInt64(&EC, i);
}
- for(int i = 0; i < QCBOR_MAX_ARRAY_NESTING-2; i++) {
+ for(int i = 0; i < BSTR_TEST_DEPTH-2; i++) {
QCBOREncode_CloseBstrWrap(&EC, NULL);
QCBOREncode_AddUInt64(&EC, i);
}
- for(int i = 0; i < (QCBOR_MAX_ARRAY_NESTING-2)/3; i++) {
+ for(int i = 0; i < (BSTR_TEST_DEPTH-2)/3; i++) {
QCBOREncode_OpenMap(&EC);
QCBOREncode_BstrWrapMapN(&EC, i+0x20);
QCBOREncode_OpenArray(&EC);
QCBOREncode_AddUInt64(&EC, i+0x10);
}
- for(int i = 0; i < (QCBOR_MAX_ARRAY_NESTING-2)/3; i++) {
+ for(int i = 0; i < (BSTR_TEST_DEPTH-2)/3; i++) {
QCBOREncode_CloseArray(&EC);
QCBOREncode_AddUInt64(&EC, i+0x30);
QCBOREncode_CloseBstrWrap(&EC, NULL);