In FLAC 1.2.1 there was an assert in FLAC__bitmath_ilog2 and FLAC__bitmath_ilog2_wide functions: unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) { unsigned l = 0; FLAC__ASSERT(v > 0); while(v >>= 1) l++; return l; } Now there's no test for the argument of FLAC__bitmath_ilog2(), and if its argument is equal to 0, the result is "undefined". FLAC__bitmath_ilog2_wide() returns 0 in this case. (Actually their arguments are really never equal to 0) This patch re-adds FLAC__ASSERT() to bitmath functions (better to have an assert in debug mode instead of undefined result). -------------- next part -------------- A non-text attachment was scrubbed... Name: 15_bitmath.patch Type: application/octet-stream Size: 3169 bytes Desc: not available Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20140628/0f7ee1c9/attachment.obj
Erik de Castro Lopo
2014-Jun-28 12:28 UTC
[flac-dev] [PATCH 15] assert for bitmath functions
lvqcl wrote:> In FLAC 1.2.1 there was an assert in FLAC__bitmath_ilog2 and > FLAC__bitmath_ilog2_wide functions:Patches 10 to 15 applied, tested and pushed. Thanks, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/