Commit 97b484a8 authored by Erwan Tulou's avatar Erwan Tulou

demux(avi): fix crash occuring when trying to open some avi files

fmt.p_extra should only reference malloc'ed memory, since it is cleaned
with free() in es_format_Clean.

This patch reuses the same logic for p_vids as that of p_auds.
parent b0830f25
...@@ -569,7 +569,10 @@ static int Open( vlc_object_t * p_this ) ...@@ -569,7 +569,10 @@ static int Open( vlc_object_t * p_this )
fmt.i_extra = fmt.i_extra =
__MIN( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ), __MIN( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) ); p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) );
fmt.p_extra = &p_vids->p_bih[1]; fmt.p_extra = malloc( fmt.i_extra );
if( !fmt.p_extra ) goto error;
memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
msg_Dbg( p_demux, "stream[%d] video(%4.4s) %"PRIu32"x%"PRIu32" %dbpp %ffps", msg_Dbg( p_demux, "stream[%d] video(%4.4s) %"PRIu32"x%"PRIu32" %dbpp %ffps",
i, (char*)&p_vids->p_bih->biCompression, i, (char*)&p_vids->p_bih->biCompression,
(uint32_t)p_vids->p_bih->biWidth, (uint32_t)p_vids->p_bih->biWidth,
......
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