]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/gsm_parser: Replace codec_id check by assert
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 11 Aug 2015 22:16:13 +0000 (00:16 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 11 Aug 2015 23:00:20 +0000 (01:00 +0200)
A parser should never be called with a mismatching codec

Found-by: Ganesh Ajjanagadde <gajjanag@mit.edu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/gsm_parser.c

index 9a3b94ef1d8bb152b413408d69d5555e249236dd..1054a30ca919fa9fe17d8fcf48c1135cd3657e4f 100644 (file)
@@ -25,6 +25,7 @@
  * Splits packets into individual blocks.
  */
 
+#include "libavutil/avassert.h"
 #include "parser.h"
 #include "gsm.h"
 
@@ -55,10 +56,7 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
             s->duration   = GSM_FRAME_SIZE * 2;
             break;
         default:
-            *poutbuf      = buf;
-            *poutbuf_size = buf_size;
-            av_log(avctx, AV_LOG_ERROR, "Invalid codec_id\n");
-            return buf_size;
+            av_assert0(0);
         }
     }