Improve error code when getting map items by label
Not-well-formed errors were being masked as not-found errors for functions like QCBORDecode_GetInt64InMapN .. for all the "InMap" functions.
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index 01a87e5..5ce62d0 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -5193,6 +5193,9 @@
};
#endif /* QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS */
+const unsigned char not_well_formed_submod_section[] = {
+ 0xa1, 0x14, 0x1f,
+};
int32_t EnterMapTest()
{
@@ -5533,6 +5536,14 @@
nReturn = DecodeNestedIterate();
+
+ QCBORDecode_Init(&DCtx, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(not_well_formed_submod_section), 0);
+ QCBORDecode_EnterMap(&DCtx, NULL);
+ QCBORDecode_EnterMapFromMapN(&DCtx, 20);
+ if(QCBORDecode_GetError(&DCtx) != QCBOR_ERR_BAD_INT) {
+ return 2500;
+ }
+
return nReturn;
}