Merge remote-tracking branch 'turbo/master'
* turbo/master: (105 commits) makemacpkg.in: Allow universal DMG w/o ARMv8 arch Remove more unnecessary NULL checks before free() Eliminate unnecessary NULL checks before tjFree() Eliminate unnecessary NULL checks before free() simd/arm64/jsimd_neon.S: Fix checkstyle issue tjTransform(): Use instance err. for bad crop spec README.md, package specs: Various tweaks djpeg.c: Fix compiler warning w/o mem. src manager ARMv8 SIMD: Support execute-only memory (XOM) Travis: Use MacPorts instead of Homebrew Huffman enc.: Fix very rare local buffer overrun TurboJPEG: Fix erroneous subsampling detection ChangeLog.md: List CVE IDs for specific fixes tjDecompressToYUV*(): Fix OOB write/double free 64-bit tjbench: Fix signed int overflow/segfault Fix copyright header formatting buglets example.txt: Avoid undefined setjmp() behavior Mac: Support hiding SIMD fct symbols w/ NASM 2.14+ TJBench: Fix output with -componly -quiet Build: Don't require ASM_NASM if !REQUIRE_SIMD ...
This commit is contained in:
@@ -58,11 +58,21 @@ endif()
|
||||
add_custom_target(javadoc COMMAND
|
||||
javadoc -notimestamp -d ${CMAKE_CURRENT_SOURCE_DIR}/doc -sourcepath ${CMAKE_CURRENT_SOURCE_DIR} org.libjpegturbo.turbojpeg)
|
||||
set(JAVACLASSPATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/turbojpeg-java.dir)
|
||||
add_custom_target(javah
|
||||
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJ
|
||||
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJCompressor
|
||||
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJDecompressor
|
||||
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJTransformer)
|
||||
if(Java_VERSION_MAJOR GREATER 9)
|
||||
add_custom_target(javah
|
||||
COMMAND javac -h ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH}
|
||||
-d ${CMAKE_CURRENT_BINARY_DIR}/__unused
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJ.java
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJCompressor.java
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJDecompressor.java
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/org/libjpegturbo/turbojpeg/TJTransformer.java)
|
||||
else()
|
||||
add_custom_target(javah
|
||||
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJ
|
||||
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJCompressor
|
||||
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJDecompressor
|
||||
COMMAND javah -d ${CMAKE_CURRENT_SOURCE_DIR} -classpath ${JAVACLASSPATH} org.libjpegturbo.turbojpeg.TJTransformer)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_JAVADIR)
|
||||
set(CMAKE_INSTALL_DEFAULT_JAVADIR "<CMAKE_INSTALL_DATAROOTDIR>/java")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2009-2014, 2016-2018 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2009-2014, 2016-2019 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -121,6 +121,8 @@ final class TJBench {
|
||||
int rindex = TJ.getRedOffset(pixelFormat);
|
||||
int gindex = TJ.getGreenOffset(pixelFormat);
|
||||
int bindex = TJ.getBlueOffset(pixelFormat);
|
||||
if ((long)w[0] * (long)h[0] * (long)ps > (long)Integer.MAX_VALUE)
|
||||
throw new Exception("Image is too large");
|
||||
byte[] dstBuf = new byte[w[0] * h[0] * ps];
|
||||
int pixels = w[0] * h[0], dstPtr = 0, rgbPtr = 0;
|
||||
|
||||
@@ -175,8 +177,11 @@ final class TJBench {
|
||||
|
||||
tjd = new TJDecompressor();
|
||||
|
||||
if (dstBuf == null)
|
||||
if (dstBuf == null) {
|
||||
if ((long)pitch * (long)scaledh > (long)Integer.MAX_VALUE)
|
||||
throw new Exception("Image is too large");
|
||||
dstBuf = new byte[pitch * scaledh];
|
||||
}
|
||||
|
||||
/* Set the destination buffer to gray so we know whether the decompressor
|
||||
attempted to write to it */
|
||||
@@ -202,7 +207,9 @@ final class TJBench {
|
||||
int width = doTile ? Math.min(tilew, w - x) : scaledw;
|
||||
int height = doTile ? Math.min(tileh, h - y) : scaledh;
|
||||
|
||||
tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
|
||||
try {
|
||||
tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
|
||||
} catch (TJException e) { handleTJException(e); }
|
||||
if (doYUV) {
|
||||
yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height, subsamp);
|
||||
try {
|
||||
@@ -329,6 +336,8 @@ final class TJBench {
|
||||
String pfStr = PIXFORMATSTR[pf];
|
||||
YUVImage yuvImage = null;
|
||||
|
||||
if ((long)pitch * (long)h > (long)Integer.MAX_VALUE)
|
||||
throw new Exception("Image is too large");
|
||||
tmpBuf = new byte[pitch * h];
|
||||
|
||||
if (quiet == 0)
|
||||
@@ -469,6 +478,8 @@ final class TJBench {
|
||||
if (!compOnly)
|
||||
decomp(srcBuf, jpegBuf, jpegSize, tmpBuf, w, h, subsamp, jpegQual,
|
||||
fileName, tilew, tileh);
|
||||
else if (quiet == 1)
|
||||
System.out.println("N/A");
|
||||
|
||||
if (tilew == w && tileh == h) break;
|
||||
}
|
||||
@@ -489,6 +500,8 @@ final class TJBench {
|
||||
int tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
|
||||
|
||||
FileInputStream fis = new FileInputStream(fileName);
|
||||
if (fis.getChannel().size() > (long)Integer.MAX_VALUE)
|
||||
throw new Exception("Image is too large");
|
||||
int srcSize = (int)fis.getChannel().size();
|
||||
srcBuf = new byte[srcSize];
|
||||
fis.read(srcBuf, 0, srcSize);
|
||||
@@ -500,7 +513,9 @@ final class TJBench {
|
||||
|
||||
tjt = new TJTransformer();
|
||||
|
||||
tjt.setSourceImage(srcBuf, srcSize);
|
||||
try {
|
||||
tjt.setSourceImage(srcBuf, srcSize);
|
||||
} catch (TJException e) { handleTJException(e); }
|
||||
w = tjt.getWidth();
|
||||
h = tjt.getHeight();
|
||||
subsamp = tjt.getSubsamp();
|
||||
@@ -607,7 +622,9 @@ final class TJBench {
|
||||
elapsed = 0.;
|
||||
while (true) {
|
||||
start = getTime();
|
||||
tjt.transform(jpegBuf, t, flags);
|
||||
try {
|
||||
tjt.transform(jpegBuf, t, flags);
|
||||
} catch (TJException e) { handleTJException(e); }
|
||||
jpegSize = tjt.getTransformedSizes();
|
||||
elapsed += getTime() - start;
|
||||
if (iter >= 0) {
|
||||
@@ -705,7 +722,7 @@ final class TJBench {
|
||||
System.out.println(" bytes to which each row of each plane in the intermediate YUV image is");
|
||||
System.out.println(" padded (default = 1)");
|
||||
System.out.println("-scale M/N = Scale down the width/height of the decompressed JPEG image by a");
|
||||
System.out.print (" factor of M/N (M/N = ");
|
||||
System.out.print(" factor of M/N (M/N = ");
|
||||
for (i = 0; i < nsf; i++) {
|
||||
System.out.format("%d/%d", scalingFactors[i].getNum(),
|
||||
scalingFactors[i].getDenom());
|
||||
|
||||
Reference in New Issue
Block a user