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
2 changes: 1 addition & 1 deletion coding/huffmantemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void HuffmanTemplate::BuildDecoder(void)
JPG_THROW(MALFORMED_STREAM,"HuffmanTemplate::ParseMarker","Huffman table marker depends on undefined data");
// There are codes of this lengths.
code += m_ucLengths[i];
if (code >= 1UL << (i + 1))
if (code > 1UL << (i + 1) || (code == 1UL << (i + 1) && values + m_ucLengths[i] < m_pucValues + m_ulCodewords))
JPG_THROW(MALFORMED_STREAM,"HuffmanTemplate::ParseMarker",
"Huffman table corrupt - entry depends on more bits than available for the bit length");
class HuffmanDecoder *huff = new(m_pEnviron) class HuffmanDecoder(values,i+1-lastbits,
Expand Down