ci,x.json2.decoder2: fix sanitize jobs

This commit is contained in:
Delyan Angelov 2025-07-26 16:53:53 +03:00
parent 318394dd47
commit b511f2239e
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -164,7 +164,8 @@ fn (mut decoder Decoder) check_struct_type_valid[T](s T, current_node Node[Value
}
if unsafe {
vmemcmp(decoder.json.str + key_info.position, type_field.str, type_field.len) == 0
key_info.position + type_field.len <= decoder.json.len
&& 0 == vmemcmp(decoder.json.str + key_info.position, type_field.str, type_field.len)
} {
// find type field
type_field_node = type_field_node.next
@ -184,8 +185,8 @@ fn (mut decoder Decoder) check_struct_type_valid[T](s T, current_node Node[Value
unsafe {
}
if unsafe {
vmemcmp(decoder.json.str + type_field_node.value.position + 1, variant_name.str,
variant_name.len) == 0
type_field_node.value.position + 1 + variant_name.len <= decoder.json.len
&& 0 == vmemcmp(decoder.json.str + type_field_node.value.position + 1, variant_name.str, variant_name.len)
} {
return true
}