Reorder operation to avoid UBsan warning The original order of operations lead to all variables upgraded to unsigned int during computation, and enc->cnt being negative then would cause UBsan warning. Change-Id: I658b6f4c903472b82e178033eac2463045c42233
diff --git a/aom_dsp/entenc.c b/aom_dsp/entenc.c index 02bee67..ad147a1 100644 --- a/aom_dsp/entenc.c +++ b/aom_dsp/entenc.c
@@ -398,7 +398,7 @@ int od_ec_enc_tell(const od_ec_enc *enc) { /*The 10 here counteracts the offset of -9 baked into cnt, and adds 1 extra bit, which we reserve for terminating the stream.*/ - return (enc->offs + enc->end_offs) * 8 + enc->cnt + enc->nend_bits + 10; + return (enc->cnt + 10 + enc->nend_bits) + (enc->offs + enc->end_offs) * 8; } /*Returns the number of bits "used" by the encoded symbols so far.