mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 08:47:28 +01:00
Add jsonptr check for to-be-extended token length
This commit is contained in:
1 parent
e511b8b891
commit
03a87ea3ef
2 files changed
+6
No files matched your search
@@ -1509,6 +1509,9 @@ handle_token(wuffs_base__token t, bool start_of_token_chain) {
|
|||||||
? ((uint64_t)(t.value_base_detail__sign_extended()))
|
? ((uint64_t)(t.value_base_detail__sign_extended()))
|
||||||
: vbd;
|
: vbd;
|
||||||
if (t.continued()) {
|
if (t.continued()) {
|
||||||
|
if (len != 0) {
|
||||||
|
return "main: internal error: unexpected to-be-extended length";
|
||||||
|
}
|
||||||
g_token_extension.category = vbc;
|
g_token_extension.category = vbc;
|
||||||
g_token_extension.detail = x;
|
g_token_extension.detail = x;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ pub const TOKEN_VALUE_MINOR__DETAIL_MASK : base.u64 = 0x003_FFFF
|
|||||||
// base.TOKEN__VALUE_EXTENSION__NUM_BITS bits. The 64-bit CBOR tag is either v
|
// base.TOKEN__VALUE_EXTENSION__NUM_BITS bits. The 64-bit CBOR tag is either v
|
||||||
// or ((v << base.TOKEN__VALUE_EXTENSION__NUM_BITS) | value_extension_1) where
|
// or ((v << base.TOKEN__VALUE_EXTENSION__NUM_BITS) | value_extension_1) where
|
||||||
// v is (value_minor_0 & TOKEN_VALUE_MINOR__DETAIL_MASK).
|
// v is (value_minor_0 & TOKEN_VALUE_MINOR__DETAIL_MASK).
|
||||||
|
//
|
||||||
|
// When a token chain contains extended tokens like this, all but the last
|
||||||
|
// token has zero length.
|
||||||
pub const TOKEN_VALUE_MINOR__TAG : base.u32 = 0x100_0000
|
pub const TOKEN_VALUE_MINOR__TAG : base.u32 = 0x100_0000
|
||||||
|
|
||||||
// TOKEN_VALUE_MINOR__MINUS_1_MINUS_X means that the 9-byte length token holds
|
// TOKEN_VALUE_MINOR__MINUS_1_MINUS_X means that the 9-byte length token holds
|
||||||
|
|||||||
Reference in new issue
Block a user