Div zero?
Hi all, This is Qianxin CodeSafe Team, we found a suspicious div-zero, at https://github.com/cisco/openh264/blob/3668daf135dea7d18737b01ce32774a7a2ffba32/codec/processing/src/adaptivequantization/AdaptiveQuantization.cpp#L192 in the maco used at https://github.com/cisco/openh264/blob/3668daf135dea7d18737b01ce32774a7a2ffba32/codec/processing/src/adaptivequantization/AdaptiveQuantization.cpp#L145 and https://github.com/cisco/openh264/blob/3668daf135dea7d18737b01ce32774a7a2ffba32/codec/processing/src/adaptivequantization/AdaptiveQuantization.cpp#L146 which is defined at https://github.com/cisco/openh264/blob/3668daf135dea7d18737b01ce32774a7a2ffba32/codec/common/inc/macros.h#L132
the second argument y of macro WELS_DIV_ROUND64 may be zero.
which means iMbTotalNum may be zero.
so at
https://github.com/cisco/openh264/blob/3668daf135dea7d18737b01ce32774a7a2ffba32/codec/processing/src/adaptivequantization/AdaptiveQuantization.cpp#L192
while dived by iMbTotalNum, a check against zero should be added.