Merge branch '1.4.x'
diff --git a/turbojpeg.c b/turbojpeg.c
index cd9bfd7..5754cb1 100644
--- a/turbojpeg.c
+++ b/turbojpeg.c
@@ -1386,7 +1386,7 @@
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;
@@ -1762,7 +1762,7 @@
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");
@@ -1908,7 +1908,7 @@
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);