I found the problem with the FDK AAC decoder segfaulting in the
community firmware.

The aacDecoder_DecodeFrame API function multiplies the buffersize
provided in the parameters by the data size causing it to try accessing
beyond the allocated output buffer.

https://github.com/ralph-irving/squeezeplay/blob/master/src/fdk-aac-2.0.1/libAACdec/src/aacdecoder_lib.cpp#L1960

I also needed to force the AAC decode thread to stop when a decode error
is encountered.

This is the patch I'm currently testing on my linux system.


Code:
--------------------
    Index: src/audio/decode/decode_aac.c
  ===================================================================
  --- src/audio/decode/decode_aac.c     (revision 1327)
  +++ src/audio/decode/decode_aac.c     (working copy)
  @@ -135,7 +135,7 @@
                return FALSE;
        }
  
  -     err = aacDecoder_DecodeFrame(self->heaacdec, (INT_PCM 
*)self->output_buffer, OUTPUT_BUFFER_SIZE, 0);
  +     err = aacDecoder_DecodeFrame(self->heaacdec, (INT_PCM 
*)self->output_buffer, OUTPUT_BUFFER_SIZE / sizeof(INT_PCM), 0);
  
        if (err == AAC_DEC_NOT_ENOUGH_BITS) {
                LOG_DEBUG(log_audio_codec, "not enough bits");
  @@ -150,14 +150,14 @@
        /* Do concealment of corrupted frames */
        if (IS_DECODE_ERROR(err)) {
                LOG_WARN(log_audio_codec, "concealing corrupted frames %x", 
err);
  -             err = aacDecoder_DecodeFrame(self->heaacdec, (INT_PCM 
*)self->output_buffer, OUTPUT_BUFFER_SIZE, AACDEC_CONCEAL);
  +             err = aacDecoder_DecodeFrame(self->heaacdec, (INT_PCM 
*)self->output_buffer, OUTPUT_BUFFER_SIZE / sizeof(INT_PCM), AACDEC_CONCEAL);
        }
  
        /* Give up decoded on any other error */
        if (err != AAC_DEC_OK) {
  -             LOG_DEBUG(log_audio_codec, "error %x", err);
  +             LOG_DEBUG(log_audio_codec, "decode aac frame error %x", err);
  
  -             current_decoder_state |= DECODE_STATE_ERROR;
  +             current_decoder_state |= DECODE_STATE_ERROR | 
DECODE_STATE_NOT_SUPPORTED ;
                return FALSE;
        }
  
--------------------


Considering I wrote the aac decoder 18 months ago and this is the first
reported issue is pretty good and it took a "bug" in lms to expose it. 
I would never had thought to test feeding mp3 data to the aac decoder.



Ralphy

*1*-Touch, *5*-Classics, *3*-Booms, *1*-UE Radio
'Squeezebox client builds'
(https://sourceforge.net/projects/lmsclients/files/) 'donations'
(https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=LL5P6365KQEXN&lc=CA&item_name=Squeezebox%20client%20builds&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted)
always appreciated.
------------------------------------------------------------------------
ralphy's Profile: http://forums.slimdevices.com/member.php?userid=3484
View this thread: http://forums.slimdevices.com/showthread.php?t=113719

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to