changeset 2703:2c2da3011d6e libavformat

make sure the mpeg audio header is valid before passing it to ff_mpegaudio_decode_header()
author andoma
date Sun, 04 Nov 2007 19:52:08 +0000
parents 6a7b82888880
children 5ab595d4eb2f
files mp3.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mp3.c	Sun Nov 04 12:46:16 2007 +0000
+++ b/mp3.c	Sun Nov 04 19:52:08 2007 +0000
@@ -435,7 +435,11 @@
     const offset_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
     MPADecodeContext c;
 
-    ff_mpegaudio_decode_header(&c, get_be32(&s->pb));
+    v = get_be32(&s->pb);
+    if(ff_mpa_check_header(v) < 0)
+      return;
+
+    ff_mpegaudio_decode_header(&c, v);
     if(c.layer != 3)
         return;