Fix incorrect data output and buffer overruns in the new tjDecompressToYUV2() function whenever scaling is used along with a 4:2:0 JPEG image; extend tjunittest and TJUnitTest to test for these issues.

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@982 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2013-05-07 21:17:35 +00:00
parent b7c41932ed
commit 418fe286c2
3 changed files with 43 additions and 19 deletions

View File

@@ -757,14 +757,15 @@ public class TJUnitTest {
String baseName, int subsamp,
int flags) throws Exception {
int i;
if (subsamp == TJ.SAMP_444 || subsamp == TJ.SAMP_GRAY) {
TJScalingFactor[] sf = TJ.getScalingFactors();
for (i = 0; i < sf.length; i++)
TJScalingFactor[] sf = TJ.getScalingFactors();
for (i = 0; i < sf.length; i++) {
int num = sf[i].getNum();
int denom = sf[i].getDenom();
if (subsamp == TJ.SAMP_444 || subsamp == TJ.SAMP_GRAY ||
(num == 1 && (denom == 4 || denom == 2 || denom == 1)))
decompTest(tjd, jpegBuf, jpegSize, w, h, pf, baseName, subsamp,
flags, sf[i]);
} else
decompTest(tjd, jpegBuf, jpegSize, w, h, pf, baseName, subsamp,
flags, new TJScalingFactor(1, 1));
}
}
private static void doTest(int w, int h, int[] formats, int subsamp,