Use OD_ILOG_NZ in OD_DIVU_SMALL_CONSTS If _d == 0 we are already off to the UB races due to out of bounds access in OD_DIVU_SMALL_CONSTS. Change-Id: I55a76c51483885bbb38667f14836be9830e130a8
diff --git a/av1/common/odintrin.h b/av1/common/odintrin.h index bce576d..68a6f90 100644 --- a/av1/common/odintrin.h +++ b/av1/common/odintrin.h
@@ -97,7 +97,7 @@ ((uint32_t)((OD_DIVU_SMALL_CONSTS[(_d)-1][0] * (uint64_t)(_x) + \ OD_DIVU_SMALL_CONSTS[(_d)-1][1]) >> \ 32) >> \ - (OD_ILOG(_d) - 1)) + (OD_ILOG_NZ(_d) - 1)) #define OD_DIVU(_x, _d) \ (((_d) < OD_DIVU_DMAX) ? (OD_DIVU_SMALL((_x), (_d))) : ((_x) / (_d)))