Handle zero-length chunks in indefinite-length strings
Previously this would generate a QCBOR_ERR_STRING_ALLOCATE error. There is no security issue or attack vector here. QCBOR just errored out on a zero-length string chunk when it should not have. Zero-length string chunks are explicitly allowed in RFC 8949
Thanks David for the catch and the fix!
* Fix decoding of an indefinite-length string with a zero-length first chunk. (#134)
Signed-off-by: David Navarro <david.navarro@ioterop.com>
* Add an unit test for #134.
Signed-off-by: David Navarro <david.navarro@ioterop.com>
Co-authored-by: David Navarro <david.navarro@ioterop.com>
diff --git a/test/qcbor_decode_tests.h b/test/qcbor_decode_tests.h
index 54e125a..11fdc94 100644
--- a/test/qcbor_decode_tests.h
+++ b/test/qcbor_decode_tests.h
@@ -313,5 +313,9 @@
*/
int32_t BoolTest(void);
+/*
+Test GitHub issue #134: decode an indefinite-length string with a zero-length first chunk.
+*/
+int32_t CBORTestIssue134(void);
#endif /* defined(__QCBOR__qcbort_decode_tests__) */