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:
Vikas Arora 2012-06-11 12:26:19 +05:30
parent 3697b5ceb2
commit 7c6898051e
2 changed files with 2 additions and 2 deletions

View File

@ -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:

View File

@ -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]);