[vlc-devel] [PATCH] libmp4: fix segfault

Francois Cartegnie fcvlcdev at free.fr
Wed Oct 29 17:38:09 CET 2014


Le 28/10/2014 23:11, Frédéric Yhuel a écrit :
>  static int MP4_NextBox( stream_t *p_stream, MP4_Box_t *p_box )
>  {
> -    MP4_Box_t box;
> +    MP4_Box_t box = {0};
>  
>      if( !p_box )
>      {
> 

Better fail early. (untested, no sample)

---
 modules/demux/mp4/libmp4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 5f02754..9cc62ef 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -150,7 +150,8 @@ static int MP4_NextBox( stream_t *p_stream,
MP4_Box_t *p_box )

     if( !p_box )
     {
-        MP4_ReadBoxCommon( p_stream, &box );
+        if ( !MP4_ReadBoxCommon( p_stream, &box ) )
+            return 0;
         p_box = &box;
     }

-- 
1.9.3





More information about the vlc-devel mailing list