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. Kevin O'Connor
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! Jean-Marc
Oh, and the code is fixed now. Jean-Marc On 12/10/2013 04:33 PM, Jean-Marc Valin wrote:> 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! > > Jean-Marc > _______________________________________________ > opus mailing list > opus at xiph.org > http://lists.xiph.org/mailman/listinfo/opus >
Seemingly Similar Threads
- Possible pointer math issue in 1.1
- [[RFC PATCH v2]: Ne10 fft fixed and previous 1/8] armv7(float): Optimize encode usecase using NE10 library
- [RFC PATCH v2] armv7(float): Optimize encode usecase using NE10 library
- [RFC PATCHv3] armv7(float): Optimize encode usecase using NE10 library
- [Re:] Re: Opus 1.2.1 crash on silk/VAD.c:315