From 03a42480b1604fe917b69bfd62d1ecfed0baaf8c Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 29 Oct 2021 15:33:31 +0400 Subject: [PATCH] Report error early --- submodules/MozjpegBinding/Sources/MozjpegBinding.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/submodules/MozjpegBinding/Sources/MozjpegBinding.m b/submodules/MozjpegBinding/Sources/MozjpegBinding.m index efb4b5deb9..a71a5f5c87 100644 --- a/submodules/MozjpegBinding/Sources/MozjpegBinding.m +++ b/submodules/MozjpegBinding/Sources/MozjpegBinding.m @@ -263,7 +263,9 @@ UIImage * _Nullable decompressImage(NSData * _Nonnull sourceData) { tjhandle _jpegDecompressor = tjInitDecompress(); - tjDecompressHeader2(_jpegDecompressor, _compressedImage, jpegSize, &width, &height, &jpegSubsamp); + if (tjDecompressHeader2(_jpegDecompressor, _compressedImage, jpegSize, &width, &height, &jpegSubsamp) != 0) { + return nil; + } int sourceBytesPerRow = (3 * width + 31) & ~0x1F; int targetBytesPerRow = (4 * width + 31) & ~0x1F;