[vlc-commits] mp4: Return an error if there are no attachments

Hugo Beauzée-Luyssen git at videolan.org
Thu Nov 26 12:48:16 CET 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Nov 23 14:52:24 2020 +0100| [505d14b41a6963b8112885414aa20df6a507406a] | committer: Hugo Beauzée-Luyssen

mp4: Return an error if there are no attachments

Instead of allocating an empty array for nothing

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=505d14b41a6963b8112885414aa20df6a507406a
---

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

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 6d370fc026..136b25b42a 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2059,6 +2059,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
             if( p_sys->i_attachments == -1 )
                 p_sys->i_attachments = MP4_GetAttachments( p_sys->p_root, &p_sys->pp_attachments );
+            if( !p_sys->i_attachments )
+                return VLC_EGENERIC;
             *ppp_attach = calloc( p_sys->i_attachments, sizeof(**ppp_attach ) );
             if( !*ppp_attach )
                 return VLC_ENOMEM;



More information about the vlc-commits mailing list