from encode_int removed assert hit by fuzzer
clamp the value instead
This commit is contained in:
parent
fc0153a1d4
commit
b64ef69b9e
|
@ -59,7 +59,10 @@ struct ByteStrBuff : hb_vector_t<char, 1>
|
||||||
return encode_byte ((v >> 8) + OpCode_TwoByteNegInt0) && encode_byte (v & 0xFF);
|
return encode_byte ((v >> 8) + OpCode_TwoByteNegInt0) && encode_byte (v & 0xFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert ((-32768 <= v) && (v <= 32767));
|
if (unlikely (v < -32768))
|
||||||
|
v = -32768;
|
||||||
|
else if (unlikely (v > 32767))
|
||||||
|
v = 32767;
|
||||||
return encode_byte (OpCode_shortint) &&
|
return encode_byte (OpCode_shortint) &&
|
||||||
encode_byte ((v >> 8) & 0xFF) &&
|
encode_byte ((v >> 8) & 0xFF) &&
|
||||||
encode_byte (v & 0xFF);
|
encode_byte (v & 0xFF);
|
||||||
|
|
Loading…
Reference in New Issue