Merge pull request #27047 from vrabaud:lzw

Move the CV_Assert above the << operation to not trigger the fuzzer
This commit is contained in:
Alexander Smorkalov 2025-03-14 09:01:15 +03:00 committed by GitHub
commit 14396b8029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -319,9 +319,9 @@ bool GifDecoder::lzwDecode() {
lzwMinCodeSize = m_strm.getByte();
const int lzwMaxSize = (1 << 12); // 4096 is the maximum size of the LZW table (12 bits)
int lzwCodeSize = lzwMinCodeSize + 1;
CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
int clearCode = 1 << lzwMinCodeSize;
int exitCode = clearCode + 1;
CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
std::vector<lzwNodeD> lzwExtraTable(lzwMaxSize + 1);
int colorTableSize = clearCode;
int lzwTableSize = exitCode;