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
@@ -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,