avcodec/h264dec: check number of SPS in is_extra
authorZhao Zhili <quinkblack@foxmail.com>
Thu, 6 Sep 2018 09:15:11 +0000 (17:15 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 7 Sep 2018 18:35:54 +0000 (20:35 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/h264dec.c

index 8d115fa..1f44ed1 100644 (file)
@@ -855,6 +855,8 @@ static int is_extra(const uint8_t *buf, int buf_size)
 {
     int cnt= buf[5]&0x1f;
     const uint8_t *p= buf+6;
+    if (!cnt)
+        return 0;
     while(cnt--){
         int nalsize= AV_RB16(p) + 2;
         if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 7)