This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C55X-AUDIOFRAMEWORK: Memory corruption when calling ASRC_genOutInterpCoefs16b()

Part Number: C55X-AUDIOFRAMEWORK

We have noticed that we can get a memory corruption after calling ASRC_genOutInterpCoefs16b(). The function sometimes write outside the pbAsrcOutFifo buffer, and destroys the memory located behind the buffer. The function is located in asrc_dly_fix_lib.lib, for which we don't have the source code for. 

We would like the source code for asrc_dly_fix_lib.lib to help debug the issue, or/and some suggestions on how to find out why this happens. I can't find the version of the lib file, but the md5sum of the .lib is 

$ md5sum asrc_dly_fix_lib.lib

d83852f1866db84b3eed896c3000441c asrc_dly_fix_lib.lib

/Olov Brändström, Google Inc

  • Hi Olov,

    Our team will need some time to gather data in the lab. Please allow us a few days and we will get back to you.

    BR
    Tsvetolin Shulev
  • Olov,

    Unfortunately, the library code cannot be shared publicly.
    I'm checking with some colleagues on the best way to debug.

    Lali
  • Olov,

    Some feedback from a colleague:
    Is the output buffer appropriately sized? Do you need more memory to accommodate interpolation?
    Assuming the buffer size is proper, can you dump the variable for the number of output samples and check if an unexpectedly large value for this variable is causing the buffer overflow? If you see a large value, you might be able to determine what’s causing it.

    Lali
  • The output buffer used in ASRC_genOutInterpCoefs16b() is pbAsrcOutFifo one of the buffers in, that have the size ASRC_OUT_FIFO_BLK_SIZE (this part of our code is unmodified files from the connected audio framework. This is quite hard to debug since it occurs a few times a week and does not seem to happen if we build in debug.

    We have noticed that the crash occurs if ASRC_genOutInterpCoefs16b() writes 192 (2*96) floats to the buffer, which is more than ASRC_OUT_FIFO_BLK_SIZE, so we write outside the block. We managed to avoid the crash by extending the pbAsrcOutFifo so that the memory corruption occurs in "safe" memory. But we need to find a real solution.

    It may be possible that we, e.g. have a performance issue that sometimes cause us to call functions in the asrc_dly_fix_lib in the wrong order, or not in time. However, since I don't understand how asrc_dly_fix_lib works, I can't know if that's likely.

    What is the variable for "the number of output samples"? I guess that's the second parameter to the call ASRC_rdNumOutSamps()? According to our dump, that value was 48 right before the crash.