diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index 7d9340010..549436414 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -59,7 +59,10 @@ struct ByteStrBuff : hb_vector_t 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);