[opus] Possible pointer math issue in 1.1
jmvalin at jmvalin.ca
Tue Dec 10 13:33:16 PST 2013
On 12/10/2013 02:08 PM, O'Connor, Kevin wrote:
> While integrating 1.1, I ran into some errors with my compiler and,
> after examining the code, saw what might be some invalid pointer math
> in opus_encoder.c. In optimize_framesize(), the first parameter 'x'
> is typed as opus_val16 and pointer math is done on the variable (in
> the 'if (buffering)' block) and then x is passed to the downmix
> function. I see that the downmix function uses the proper type, but
> it appears to me that the pointer adjustment performed in that 'if
> (buffering)' block is always using 16-bit.
You're right, the first parameter optimize_framesize() should be a "void
*x" and the pointer arithmetic on x is wrong. Fortunately, that code is
currently not enabled (and not exposed to the API) because it doesn't
work well (probably not only because of the bug you just found). Thanks
for spotting this!
More information about the opus