[vlc-commits] demux: libmp4: set avcC size after alloc
Francois Cartegnie
git at videolan.org
Wed Aug 22 18:12:08 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Aug 22 13:42:29 2018 +0200| [2f4d144b3f5b90fe3dfef38044385943521921fd] | committer: Francois Cartegnie
demux: libmp4: set avcC size after alloc
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2f4d144b3f5b90fe3dfef38044385943521921fd
---
modules/demux/mp4/libmp4.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index f3c7b58676..f9280783e5 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1833,12 +1833,14 @@ static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_ENTER( MP4_Box_data_avcC_t, MP4_FreeBox_avcC );
p_avcC = p_box->data.p_avcC;
- p_avcC->i_avcC = i_read;
- if( p_avcC->i_avcC > 0 )
+ if( i_read > 0 )
{
- uint8_t * p = p_avcC->p_avcC = malloc( p_avcC->i_avcC );
- if( p )
- memcpy( p, p_peek, i_read );
+ p_avcC->p_avcC = malloc( i_read );
+ if( p_avcC->p_avcC )
+ {
+ memcpy( p_avcC->p_avcC, p_peek, i_read );
+ p_avcC->i_avcC = i_read;
+ }
}
MP4_GET1BYTE( p_avcC->i_version );
More information about the vlc-commits
mailing list