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.

This commit is contained in:
DRC
2013-05-07 21:17:35 +00:00
parent 6586b254ee
commit 22be928d5a
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,