This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

[Bug report]OPUS, array out of range

[Version]: nRFready Smart Remote 3 nRF52 v1.2.1alpha

[Project]: nRFready Smart Remote 3 nRF52 v1.2.1alpha\nRF5x SDK-SR3\examples\ble_peripheral\smart_remote_3_nrf52

[File]:smart_remote_3_nrf52\Source\Libraries\opus-1.2.1\define.h

Here is a define:

42 /* Number of decoder channels (1/2) */
43 #define DECODER_NUM_CHANNELS 1

as we see, the macro's value is 1

but in file: dec_API.c

it try to get &channel_state[ 1 ], channel_state points to psDec->channel_state, psDec is struct silk_decoder, 

so we found channel_state is a array with 1 size, &channel_state[1] will cause out of range!!!

I check original macro from opus-1.2.1, the DECODER_NUM_CHANNELS is 2, 

Hope to fix

Thanks.

Parents
  • Hi Lin, 

    Thank you for letting us know.

    I agree that this looks like a bug. 

    The Smart Remote 3 firmware only uses the OPUS library for encoding since the the audio is only going from the remote to the Ubuntu host. The OPUS library is optimized for size in the SR3 firmware, so unless you're adding support for audio in both directions, then the SILK encoder is most likely optimized out. Are you adding support for encoding in a remote product?

    Best regards

    Bjørn

  • I only used opus silk decoder in my project, and encoder had been optimized out after compiling. Does it have any influence if I only use decoder?

  • Hi Lin, 

    I got one of the devs to check if setting DECODER_NUM_CHANNELS to 2 would affect the final code size of the library in the SR3 project(which only uses the encoder) and it did not, i.e. the decoder it is optimized out. However, if you're only using the decoder and not the encoder, then you should set DECODER_NUM_CHANNELS to 2. We have not done as much testing of the decoder part of our OPUS port as we have with the encoder( since this is the only part we're using), but it should work fine. Let me know if it does not. 

    Best regards

    Bjørn

Reply
  • Hi Lin, 

    I got one of the devs to check if setting DECODER_NUM_CHANNELS to 2 would affect the final code size of the library in the SR3 project(which only uses the encoder) and it did not, i.e. the decoder it is optimized out. However, if you're only using the decoder and not the encoder, then you should set DECODER_NUM_CHANNELS to 2. We have not done as much testing of the decoder part of our OPUS port as we have with the encoder( since this is the only part we're using), but it should work fine. Let me know if it does not. 

    Best regards

    Bjørn

Children
No Data
Related