Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A partition order could occur, such that the block size was not a multiple of 2^order. Computation of the number of samples per partition did not account for this case, rounding down due to the bit shift. This meant that we would not fill the entire decode buffer. Claxon does not zero the decode buffer because it is (should be) overwritten anyway, and in the case of a format error, where the buffer might be only partially full, the buffer is not exposed again. Furthermore, the way decoding works in most places, is that we fill the entire buffer, just by looping to fill it. If the input bitstream does not contain enough data to fill the buffer, then that's a format error. In a few places though, we need to slice up the buffer before decoding into it: for decoding individual channels, and also for decoding residuals, which are split into partitions. This particular format error was especially nasty because it did not cause a format error down the line. Instead, it caused the buffer to be sliced in a way where the slices together did not cover the entire buffer, and so parts of uninitialized memory could remain in the buffer. Thanks a lot to Sergey "Shnatsel" Davidoff for reporting this bug, together with elaborate steps to reproduce that allowed me to pinpoint the cause quickly.
- Loading branch information