Josh Coalson wrote in 2009 <http://lists.xiph.org/pipermail/flac-dev/2009-April/002654.html>: "the reference encoder has avoided negative shifts entirely since 1.1.4. negative shifts were meant to be positive shifts in the opposite direction but they were implemented directly with << >> and in C negative shifts are undefined. treat as an error for now to avoid bad behavior but I need to come back to this to specify exactly." But libFLAC itself doesn't care about their values. It checks a value of qlp_coeff_precision, though. So this patch adds a check of a value of quantization_level. I'm not sure what should libFLAC do if a negative (=invalid) value of quantization_level is encountered. But it seems logical that it should treat an invalid value of quantization_level in the same way as it treats an invalid value of qlp_coeff_precision. The patch should also remove "shift exponent is negative" errors reported at <https://sourceforge.net/p/flac/bugs/431/>. See also <https://sourceforge.net/p/flac/bugs/424/>. -------------- next part -------------- A non-text attachment was scrubbed... Name: qlp_shift.patch Type: application/octet-stream Size: 736 bytes Desc: not available Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20150808/26422ca8/attachment.obj
Erik de Castro Lopo
2015-Aug-11 09:44 UTC
[flac-dev] [PATCH] treat negative qlp_shift as an error
lvqcl wrote:> Josh Coalson wrote in 2009 <http://lists.xiph.org/pipermail/flac-dev/2009-April/002654.html>: > > "the reference encoder has > avoided negative shifts entirely since 1.1.4. negative shifts > were meant to be positive shifts in the opposite direction but > they were implemented directly with << >> and in C negative shifts > are undefined. > treat as an error for now to avoid bad behavior but I need to > come back to this to specify exactly." > > But libFLAC itself doesn't care about their values. It checks a value > of qlp_coeff_precision, though. So this patch adds a check of > a value of quantization_level. > > > I'm not sure what should libFLAC do if a negative (=invalid) value of > quantization_level is encountered. But it seems logical that it should > treat an invalid value of quantization_level in the same way as it treats > an invalid value of qlp_coeff_precision. > > The patch should also remove "shift exponent is negative" errors > reported at <https://sourceforge.net/p/flac/bugs/431/>. > See also <https://sourceforge.net/p/flac/bugs/424/>.Applied. Thanks. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/