ARM-software / CMSIS-DSP

CMSIS-DSP embedded compute library for Cortex-M and Cortex-A
https://arm-software.github.io/CMSIS-DSP
Apache License 2.0
518 stars 133 forks source link

buffer overflow in arm_conv_q15 and q7 #124

Closed christophe0606 closed 10 months ago

christophe0606 commented 11 months ago

Running tests on Zephyr for mps3_an547 (Cortex-M55 with DSP support) west build -p -b mps3_an547 tests/lib/cmsis_dsp/filtering -T libraries.cmsis_dsp.filtering.misc.fpu -t run A buffer overflow is detected.

Code in the tested functions seem suspicious: arm_conv_q15 and arm_conv_q7.

The loop in arm_conv_q31 does not display the same suspicious exit condition.

For what it’s worth, changing those conditions to either >= 2 or > 1 solves the issue and lets the test pass successfully.

christophe0606 commented 10 months ago

Tentative fix in the latest commit.

ithinuel commented 10 months ago

This can be confirmed by running the Zephyr tests for cmsis-dsp (eg here) on an547 with:

west build -p -b mps3_an547 tests/lib/cmsis_dsp/filtering -T libraries.cmsis_dsp.filtering.misc.fpu -t run

christophe0606 commented 10 months ago

It was confirmed as solved (private communication).