Commit 6f345c6a authored by Alex Converse's avatar Alex Converse

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
parent b5bb244c
......@@ -97,7 +97,7 @@ extern uint32_t OD_DIVU_SMALL_CONSTS[OD_DIVU_DMAX][2];
((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)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment