[vlc-devel] [RFC] demux/mp4: fix 17584: signal error if ReadBox_default fails

Filip Roséen filip at atch.se
Tue Nov 1 03:03:59 CET 2016

If no matching handler is found for a certain box, MP4_ReadBox_default
is invoked. Given that the function always return a value equal to
success, we can get stuck trying to parse it over and over.

Making sure that MP4_ReadBox_default signals that it cannot handle the
box also means that the box is discarded, and that we skip to the next
one (MP4_ReadBoxContainerChildrenIndexed).

fixes #17584


This patch is marked RFC due to me not having enough experience with
demux/mp4/libmp4.c; as such there could be a far more viable
alternative to solving this issue, and I am not sure if the changes in
this patch breaks something else.

Judging from my local testing everything is working as expected for my
samples, but.. better safe than sorry.

Best Regards,
 modules/demux/mp4/libmp4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 5ea8f8a..8dcf96a 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -4001,7 +4001,7 @@ static int MP4_ReadBox_default( stream_t *p_stream, MP4_Box_t *p_box )
                 msg_Warn( p_stream,
                           "unknown handler type in stsd (incompletely loaded)" );
-                return 1;
+                return 0;
@@ -4016,7 +4016,7 @@ unknown:
                 (char*)&p_box->i_type+1 );
     p_box->e_flags |= BOX_FLAG_INCOMPLETE;
-    return 1;
+    return 0;
 /**** ------------------------------------------------------------------- ****/

More information about the vlc-devel mailing list