mirror of
https://github.com/webmproject/libwebp.git
synced 2025-12-23 21:46:26 +01:00
Do not index costs out of bounds.
In practice, the value is never read. Change-Id: Idb33dad2581e597bd5e5b5c9414ae2c34f3a8ef2
This commit is contained in:
@@ -646,7 +646,13 @@ static int TrellisQuantizeBlock(const VP8Encoder* WEBP_RESTRICT const enc,
|
||||
int best_prev;
|
||||
score_t cost, score;
|
||||
|
||||
ss_cur[m].costs = costs[n + 1][ctx];
|
||||
// costs is [16][NUM_CTX == 3] but ss_cur[m].costs is only read after
|
||||
// being swapped with ss_prev: the last value can be NULL.
|
||||
if (n + 1 < 16) {
|
||||
ss_cur[m].costs = costs[n + 1][ctx];
|
||||
} else {
|
||||
ss_cur[m].costs = NULL;
|
||||
}
|
||||
if (level < 0 || level > thresh_level) {
|
||||
ss_cur[m].score = MAX_COST;
|
||||
// Node is dead.
|
||||
|
||||
Reference in New Issue
Block a user