mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Fix asserts in Palette and BackwardReference code.
Fix inequality assertion on number of palette colors. Fix inequality assertion test in BackwardReferencesHashChainFollowChosenPath. Change-Id: Ie3242f1bbeaf96db91b839b6732ccce2634cebf3
This commit is contained in:
parent
3697b5ceb2
commit
7c6898051e
@ -613,7 +613,7 @@ static int BackwardReferencesHashChainFollowChosenPath(
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(size < refs->max_size);
|
assert(size <= refs->max_size);
|
||||||
refs->size = size;
|
refs->size = size;
|
||||||
ok = 1;
|
ok = 1;
|
||||||
Error:
|
Error:
|
||||||
|
@ -829,7 +829,7 @@ static WebPEncodingError ApplyPalette(VP8LBitWriter* const bw,
|
|||||||
// Save palette to bitstream.
|
// Save palette to bitstream.
|
||||||
VP8LWriteBits(bw, 1, TRANSFORM_PRESENT);
|
VP8LWriteBits(bw, 1, TRANSFORM_PRESENT);
|
||||||
VP8LWriteBits(bw, 2, COLOR_INDEXING_TRANSFORM);
|
VP8LWriteBits(bw, 2, COLOR_INDEXING_TRANSFORM);
|
||||||
assert(palette_size >= 2);
|
assert(palette_size >= 1);
|
||||||
VP8LWriteBits(bw, 8, palette_size - 1);
|
VP8LWriteBits(bw, 8, palette_size - 1);
|
||||||
for (i = palette_size - 1; i >= 1; --i) {
|
for (i = palette_size - 1; i >= 1; --i) {
|
||||||
palette[i] = VP8LSubPixels(palette[i], palette[i - 1]);
|
palette[i] = VP8LSubPixels(palette[i], palette[i - 1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user