From 730a93d46d103cb76dcd50929865167241c19f9c Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Sun, 6 Jul 2008 22:12:03 +0000 Subject: [PATCH] Fixed potential invalid reads. --- modules/demux/flac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/demux/flac.c b/modules/demux/flac.c index 18f6d88a6f..86a81fb4b7 100644 --- a/modules/demux/flac.c +++ b/modules/demux/flac.c @@ -678,17 +678,17 @@ static void ParsePicture( demux_t *p_demux, const uint8_t *p_data, int i_data ) i_type = GetDWBE( p_data ); RM(4); i_len = GetDWBE( p_data ); RM(4); - if( i_data < i_len + 4 ) + if( i_len < 0 || i_data < i_len + 4 ) goto error; psz_mime = strndup( p_data, i_len ); RM(i_len); i_len = GetDWBE( p_data ); RM(4); - if( i_data < i_len + 4*4 + 4) + if( i_len < 0 || i_data < i_len + 4*4 + 4) goto error; psz_description = strndup( p_data, i_len ); RM(i_len); EnsureUTF8( psz_description ); RM(4*4); i_len = GetDWBE( p_data ); RM(4); - if( i_len > i_data ) + if( i_len < 0 || i_len > i_data ) goto error; msg_Dbg( p_demux, "FLAC: Picture type=%d mime=%s description='%s' file length=%d", -- 2.39.2