[vlc-commits] demux: libasf: fix unchecked allocs/charset conversion
Francois Cartegnie
git at videolan.org
Sun Dec 25 22:48:18 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec 25 21:38:15 2016 +0100| [9e2543f50dbdb036cf80ca39a3690b037c416663] | committer: Francois Cartegnie
demux: libasf: fix unchecked allocs/charset conversion
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9e2543f50dbdb036cf80ca39a3690b037c416663
---
modules/demux/asf/libasf.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c
index c5213ce..803effd 100644
--- a/modules/demux/asf/libasf.c
+++ b/modules/demux/asf/libasf.c
@@ -400,15 +400,18 @@ static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj )
if( p_record->i_type == ASF_METADATA_TYPE_STRING )
{
p_record->p_data = (uint8_t *)ASF_READS( i_data );
- p_record->i_data = i_data/2; /* FIXME Is that needed ? */
+ if( p_record->p_data )
+ p_record->i_data = i_data/2; /* FIXME Is that needed ? */
}
else if( p_record->i_type == ASF_METADATA_TYPE_BYTE )
{
p_record->p_data = malloc( i_data );
- p_record->i_data = i_data;
- if( p_record->p_data && i_data > 0 )
- memcpy( p_record->p_data, p_data, i_data );
-
+ if( p_record->p_data )
+ {
+ p_record->i_data = i_data;
+ if( p_record->p_data && i_data > 0 )
+ memcpy( p_record->p_data, p_data, i_data );
+ }
p_data += i_data;
}
else if( p_record->i_type == ASF_METADATA_TYPE_QWORD )
More information about the vlc-commits
mailing list