]> granicus.if.org Git - libjpeg-turbo/commitdiff
Eliminate cppcheck false positive in turbojpeg.c
authorDRC <information@libjpeg-turbo.org>
Thu, 27 Aug 2015 01:29:36 +0000 (20:29 -0500)
committerDRC <information@libjpeg-turbo.org>
Thu, 27 Aug 2015 01:29:36 +0000 (20:29 -0500)
turbojpeg.c

index 5ba9a19be3eed05596b7c90b6477d72f3a4d532f..6b2c62320cd982eb9d4b2589ace618e23d5bfd16 100644 (file)
@@ -1381,7 +1381,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf,
                if(scaledw<=width && scaledh<=height)
                        break;
        }
-       if(scaledw>width || scaledh>height)
+       if(i>=NUMSF)
                _throw("tjDecompress2(): Could not scale down to desired image dimensions");
        width=scaledw;  height=scaledh;
        dinfo->scale_num=sf[i].num;
@@ -1756,7 +1756,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle,
                if(scaledw<=width && scaledh<=height)
                        break;
        }
-       if(scaledw>width || scaledh>height)
+       if(i>=NUMSF)
                _throw("tjDecompressToYUVPlanes(): Could not scale down to desired image dimensions");
        if(dinfo->num_components>3)
                _throw("tjDecompressToYUVPlanes(): JPEG image must have 3 or fewer components");
@@ -1902,7 +1902,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle,
                if(scaledw<=width && scaledh<=height)
                        break;
        }
-       if(scaledw>width || scaledh>height)
+       if(i>=NUMSF)
                _throw("tjDecompressToYUV2(): Could not scale down to desired image dimensions");
 
        pw0=tjPlaneWidth(0, width, jpegSubsamp);