avcodec/flac_parser: Update nb_headers_buffered
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 24 Nov 2016 14:29:52 +0000 (15:29 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 4 Dec 2016 19:25:15 +0000 (20:25 +0100)
Fixes infinite loop
Fixes: fuzz.flac

Found-by: Frank Liberato <liberato@google.com>
Reviewed-by: Frank Liberato <liberato@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2475858889cde6221677473b663df6f985add33d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/flac_parser.c

index 183fe6e..6df531b 100644 (file)
@@ -586,10 +586,12 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
             temp = curr->next;
             av_freep(&curr->link_penalty);
             av_free(curr);
+            fpc->nb_headers_buffered--;
         }
         fpc->headers = fpc->best_header->next;
         av_freep(&fpc->best_header->link_penalty);
         av_freep(&fpc->best_header);
+        fpc->nb_headers_buffered--;
     }
 
     /* Find and score new headers.                                     */