Commit c14f9cdf authored by Tristan Matthews's avatar Tristan Matthews

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

Also covers #2575 and #11514
parent e827a940
......@@ -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