from encode_int removed assert hit by fuzzer

clamp the value instead
pull/1113/head
Michiharu Ariza 6 years ago
parent fc0153a1d4
commit b64ef69b9e
  1. 5
      src/hb-subset-cff-common.hh

@ -59,7 +59,10 @@ struct ByteStrBuff : hb_vector_t<char, 1>
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) &&
encode_byte ((v >> 8) & 0xFF) &&
encode_byte (v & 0xFF);

Loading…
Cancel
Save