Skip to content

Commit

Permalink
don't allow unknown subsampling
Browse files Browse the repository at this point in the history
  • Loading branch information
qbnu committed Jun 20, 2024
1 parent 1c89052 commit 810dcd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JPEGView/TJPEGWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void * TurboJpeg::ReadImage(int &width,
chromoSubsampling = (TJSAMP)tj3Get(hDecoder, TJPARAM_SUBSAMP);
if (abs((double)width * height) > MAX_IMAGE_PIXELS) {
outOfMemory = true;
} else if (width <= MAX_IMAGE_DIMENSION && height <= MAX_IMAGE_DIMENSION) {
} else if (width <= MAX_IMAGE_DIMENSION && height <= MAX_IMAGE_DIMENSION && chromoSubsampling != TJSAMP_UNKNOWN) {
pPixelData = new(std::nothrow) unsigned char[TJPAD(width * 3) * height];
if (pPixelData != NULL) {
nResult = tj3Decompress8(hDecoder, (unsigned char*)buffer, sizebytes, pPixelData, TJPAD(width * 3), TJPF_BGR);
Expand Down

0 comments on commit 810dcd3

Please sign in to comment.