[FFmpeg-devel] [PATCH]Fix infinite loop from ticket #3089

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Oct 28 19:18:06 CET 2013


Hi!

Attached patch fixes ticket #3089 for me.

Please comment, Carl Eugen
-------------- next part --------------
From 0e85bfec6814598b89653f386f98f8577ab0596a Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Mon, 28 Oct 2013 19:16:12 +0100
Subject: [PATCH] Avoid an infinite loop when decoding cook.

Fixes ticket #3089.
---
 libavcodec/cook.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 083d26b..e6da8a3 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -331,9 +331,11 @@ static void decode_gain_info(GetBitContext *gb, int *gaininfo)
 {
     int i, n;
 
-    while (get_bits1(gb)) {
+    while (get_bits_left(gb) && get_bits1(gb)) {
         /* NOTHING */
     }
+    if (!get_bits_left(gb))
+        return;
 
     n = get_bits_count(gb) - 1;     // amount of elements*2 to update
 
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list