[vlc-commits] demux: libmp4: fix zero length strings reading

Francois Cartegnie git at videolan.org
Tue Mar 13 19:09:31 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Mar 13 13:30:59 2018 +0100| [10fac2e6487ea48f7503cda96336c5e0f1481837] | committer: Francois Cartegnie

demux: libmp4: fix zero length strings reading

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

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

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index e290c8d780..6440d2f009 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -105,6 +105,16 @@ static char *mp4_getstringz( uint8_t **restrict in, uint64_t *restrict size )
 {
     assert( *size <= SSIZE_MAX );
 
+    if( *size == 0 )
+        return NULL;
+
+    if( *in == 0 ) /* Null string stored */
+    {
+        *in += 1;
+        *size -= 1;
+        return NULL;
+    }
+
     size_t len = strnlen( (const char *)*in, *size );
     if( len == 0 || len >= *size )
         return NULL;



More information about the vlc-commits mailing list