Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/jpegli/color_quantize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ void CreateInverseColorMap(j_decompress_ptr cinfo) {
int ncomp = cinfo->out_color_components;
JPEGLI_CHECK(ncomp > 0);
JPEGLI_CHECK(ncomp <= kMaxComponents);
if (cinfo->actual_number_of_colors > 256) {
JPEGLI_ERROR("Too many quantization colors (%d)",
cinfo->actual_number_of_colors);
}
int num_cells = 1;
for (int c = 0; c < ncomp; ++c) {
num_cells *= (1 << kNumColorCellBits[c]);
Expand Down