mirror of
https://github.com/webmproject/libwebp.git
synced 2025-12-23 21:46:26 +01:00
Prevent some overflow during MBAnalyze
kThreshold * m2 can be 17 * (16*(16*255)^2) in the worst case. Change-Id: Id9d82a7f2f933273bb04e7df37aaf724b3a69f43
This commit is contained in:
@@ -261,9 +261,10 @@ static int FastMBAnalyze(VP8EncIterator* const it) {
|
||||
// Empirical cut-off value, should be around 16 (~=block size). We use the
|
||||
// [8-17] range and favor intra4 at high quality, intra16 for low quality.
|
||||
const int q = (int)it->enc->config->quality;
|
||||
const uint32_t kThreshold = 8 + (17 - 8) * q / 100;
|
||||
const uint64_t kThreshold = 8 + (17 - 8) * q / 100;
|
||||
int k;
|
||||
uint32_t dc[16], m, m2;
|
||||
uint32_t dc[16];
|
||||
uint64_t m, m2;
|
||||
for (k = 0; k < 16; k += 4) {
|
||||
VP8Mean16x4(it->yuv_in + Y_OFF_ENC + k * BPS, &dc[k]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user