Commit 418ff2ed authored by Tristan Matthews's avatar Tristan Matthews Committed by Jean-Baptiste Kempf

faad: always drop byte of padding (fixes #5257)

Also covers #2575 and #11514

(cherry picked from commit c14f9cdfb7e9e66eb16bb6f81982a07ada6d865a)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 2cffc682
......@@ -313,7 +313,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
/* Decode all data */
if( p_sys->i_buffer )
if( p_sys->i_buffer > 1)
{
void *samples;
faacDecFrameInfo frame;
......@@ -395,11 +395,16 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* Flush the buffer */
p_sys->i_buffer -= frame.bytesconsumed;
if( p_sys->i_buffer > 0 )
if( p_sys->i_buffer > 1 )
{
memmove( p_sys->p_buffer,&p_sys->p_buffer[frame.bytesconsumed],
p_sys->i_buffer );
}
else
{
/* Drop byte of padding */
p_sys->i_buffer = 0;
}
block_Release( p_block );
return NULL;
}
......@@ -508,6 +513,11 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return p_out;
}
else
{
/* Drop byte of padding */
p_sys->i_buffer = 0;
}
block_Release( p_block );
return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment