From 31fe11a57a74c17e92ab40546b9cded139e20eda Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Thu, 15 Sep 2016 02:38:28 -0700 Subject: [PATCH] fix infinite loop in case of PARTITION0 overflow max_i4_header_bits_ could drop to zero for difficult image and trigger a loop. Surprisingly, StatLoop() didn't have this bug. Change-Id: Idc0f9eadef30a2b2f02041b994f25def30901e36 (cherry picked from commit 21e7537abeb01ad8d5d05c7d27b3f3b22dc85a62) --- src/enc/frame.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enc/frame.c b/src/enc/frame.c index 138afcf5..57fc471d 100644 --- a/src/enc/frame.c +++ b/src/enc/frame.c @@ -816,7 +816,7 @@ int VP8EncTokenLoop(VP8Encoder* const enc) { num_pass_left, stats.last_value, stats.value, stats.last_q, stats.q, stats.dq); #endif - if (size_p0 > PARTITION0_SIZE_LIMIT) { + if (enc->max_i4_header_bits_ > 0 && size_p0 > PARTITION0_SIZE_LIMIT) { ++num_pass_left; enc->max_i4_header_bits_ >>= 1; // strengthen header bit limitation... continue; // ...and start over