Have std/cbor reject nested indefinite-len strings

This commit is contained in:
Nigel Tao committed 2020-07-22 23:14:29 +10:00
1 parent c0ffa2a2d5
commit 1d89fd5915
2 files changed
+12

No files matched your search

+6
View File
@@ -16598,6 +16598,9 @@ wuffs_cbor__decoder__decode_tokens(
(((uint64_t)(1)) << WUFFS_BASE__TOKEN__CONTINUED__SHIFT) |
(((uint64_t)(((uint32_t)(WUFFS_CBOR__TOKEN_LENGTHS[v_c_minor])))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
} else if (v_c_minor == 31) {
if (v_indefinite_string_major_type != 0) {
goto label__goto_fail__break;
}
v_indefinite_string_major_type = 2;
*iop_a_dst++ = wuffs_base__make_token(
(((uint64_t)(4194560)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
@@ -16660,6 +16663,9 @@ wuffs_cbor__decoder__decode_tokens(
(((uint64_t)(1)) << WUFFS_BASE__TOKEN__CONTINUED__SHIFT) |
(((uint64_t)(((uint32_t)(WUFFS_CBOR__TOKEN_LENGTHS[v_c_minor])))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
} else if (v_c_minor == 31) {
if (v_indefinite_string_major_type != 0) {
goto label__goto_fail__break;
}
v_indefinite_string_major_type = 3;
*iop_a_dst++ = wuffs_base__make_token(
(((uint64_t)(4194579)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
+6
View File
@@ -248,6 +248,9 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
continued: 1,
length: TOKEN_LENGTHS[c_minor] as base.u32)
} else if c_minor == 0x1F {
if indefinite_string_major_type <> 0 {
break.goto_fail
}
indefinite_string_major_type = 2
args.dst.write_simple_token_fast!(
value_major: 0,
@@ -324,6 +327,9 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
continued: 1,
length: TOKEN_LENGTHS[c_minor] as base.u32)
} else if c_minor == 0x1F {
if indefinite_string_major_type <> 0 {
break.goto_fail
}
indefinite_string_major_type = 3
args.dst.write_simple_token_fast!(
value_major: 0,