Hello community, here is the log from the commit of package libjpeg-turbo for openSUSE:Factory checked in at 2020-08-15 21:17:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libjpeg-turbo (Old) and /work/SRC/openSUSE:Factory/.libjpeg-turbo.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libjpeg-turbo" Sat Aug 15 21:17:56 2020 rev:53 rq:826188 version:unknown Changes: -------- --- /work/SRC/openSUSE:Factory/libjpeg-turbo/libjpeg-turbo.changes 2020-06-10 00:34:58.632844753 +0200 +++ /work/SRC/openSUSE:Factory/.libjpeg-turbo.new.3399/libjpeg-turbo.changes 2020-08-15 21:18:03.999544103 +0200 @@ -1,0 +2,32 @@ +Wed Aug 12 21:24:44 UTC 2020 - Matthias Eliasson <[email protected]> + +- Update to version 2.0.5 + * Worked around issues in the MIPS DSPr2 SIMD extensions that caused failures + in the libjpeg-turbo regression tests. Specifically, the + jsimd_h2v1_downsample_dspr2() and jsimd_h2v2_downsample_dspr2() functions + in the MIPS DSPr2 SIMD extensions are now disabled until/unless they can be + fixed, and other functions that are incompatible with big endian MIPS CPUs + are disabled when building libjpeg-turbo for such CPUs. + * Fixed an oversight in the TJCompressor.compress(int) method in the + TurboJPEG Java API that caused an error ("java.lang.IllegalStateException: + No source image is associated with this instance") when attempting to use + that method to compress a YUV image. + * Fixed an issue (CVE-2020-13790) in the PPM reader that caused a buffer + overrun in cjpeg, TJBench, or the tjLoadImage() function if one of the + values in a binary PPM/PGM input file exceeded the maximum value defined in + the file's header and that maximum value was less than 255. libjpeg-turbo + 1.5.0 already included a similar fix for binary PPM/PGM files with maximum + values greater than 255. + * The TurboJPEG API library's global error handler, which is used in + functions such as tjBufSize() and tjLoadImage() that do not require a + TurboJPEG instance handle, is now thread-safe on platforms that support + thread-local storage. +- Fix source verification +- Drop patches fixed upstream: + * ctest-depends.patch + * libjpeg-turbo-CVE-2020-13790.patch +- Run spec-cleaner + * Remove package groups + * Use make macros + +------------------------------------------------------------------- --- /work/SRC/openSUSE:Factory/libjpeg-turbo/libjpeg62-turbo.changes 2020-06-10 00:35:00.180848905 +0200 +++ /work/SRC/openSUSE:Factory/.libjpeg-turbo.new.3399/libjpeg62-turbo.changes 2020-08-15 21:18:04.147544188 +0200 @@ -1,0 +2,31 @@ +Wed Aug 12 21:24:44 UTC 2020 - Matthias Eliasson <[email protected]> + +- Update to version 2.0.5 + * Worked around issues in the MIPS DSPr2 SIMD extensions that caused failures + in the libjpeg-turbo regression tests. Specifically, the + jsimd_h2v1_downsample_dspr2() and jsimd_h2v2_downsample_dspr2() functions + in the MIPS DSPr2 SIMD extensions are now disabled until/unless they can be + fixed, and other functions that are incompatible with big endian MIPS CPUs + are disabled when building libjpeg-turbo for such CPUs. + * Fixed an oversight in the TJCompressor.compress(int) method in the + TurboJPEG Java API that caused an error ("java.lang.IllegalStateException: + No source image is associated with this instance") when attempting to use + that method to compress a YUV image. + * Fixed an issue (CVE-2020-13790) in the PPM reader that caused a buffer + overrun in cjpeg, TJBench, or the tjLoadImage() function if one of the + values in a binary PPM/PGM input file exceeded the maximum value defined in + the file's header and that maximum value was less than 255. libjpeg-turbo + 1.5.0 already included a similar fix for binary PPM/PGM files with maximum + values greater than 255. + * The TurboJPEG API library's global error handler, which is used in + functions such as tjBufSize() and tjLoadImage() that do not require a + TurboJPEG instance handle, is now thread-safe on platforms that support + thread-local storage. +- Drop patches fixed upstream: + * ctest-depends.patch + * libjpeg-turbo-CVE-2020-13790.patch +- Run spec-cleaner + * Remove package groups + * Use make macros + +------------------------------------------------------------------- Old: ---- ctest-depends.patch libjpeg-turbo-2.0.4.tar.gz libjpeg-turbo-2.0.4.tar.gz.sig libjpeg-turbo-CVE-2020-13790.patch New: ---- libjpeg-turbo-2.0.5.tar.gz libjpeg-turbo-2.0.5.tar.gz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libjpeg-turbo.spec ++++++ --- /var/tmp/diff_new_pack.ArKpKn/_old 2020-08-15 21:18:05.799545131 +0200 +++ /var/tmp/diff_new_pack.ArKpKn/_new 2020-08-15 21:18:05.799545131 +0200 @@ -18,8 +18,7 @@ %define asan_build 0 %define debug_build 0 - -%define srcver 2.0.4 +%define srcver 2.0.5 %define major 8 %define minor 2 %define micro 2 @@ -33,14 +32,12 @@ Release: 0 Summary: A SIMD-accelerated library for manipulating JPEG image files License: BSD-3-Clause -Group: Productivity/Graphics/Convertors -URL: https://github.com/libjpeg-turbo/libjpeg-turbo +URL: https://sourceforge.net/projects/libjpeg-turbo Source0: http://downloads.sf.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz -Source1: baselibs.conf +Source1: http://downloads.sf.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz.sig +Source2: libjpeg-turbo.keyring +Source3: baselibs.conf Patch1: libjpeg-turbo-1.3.0-tiff-ojpeg.patch -Patch2: ctest-depends.patch -# CVE-2020-13790 [bsc#1172491], heap-based buffer over-read in get_rgb_row() in rdppm.c via a malformed PPM input file -Patch3: libjpeg-turbo-CVE-2020-13790.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkgconfig @@ -68,7 +65,6 @@ Version: %{libver} Release: 0 Summary: A SIMD-accelerated JPEG compression/decompression library -Group: System/Libraries %description -n libjpeg%{major} A library for manipulating JPEG images. It supports @@ -79,7 +75,6 @@ Version: %{version} Release: 0 Summary: A SIMD-accelerated JPEG compression/decompression library -Group: System/Libraries %description -n libturbojpeg%{tmajor} A library for manipulating JPEG images. It supports @@ -90,7 +85,6 @@ Version: %{libver} Release: 0 Summary: Development Tools for applications which will use the Libjpeg Library -Group: Development/Libraries/C and C++ Requires: libjpeg%{major} = %{version} Requires: libturbojpeg%{tmajor} = %{version} Conflicts: libjpeg-devel @@ -105,8 +99,6 @@ %prep %setup -q %patch1 -%patch2 -p1 -%patch3 -p1 %build MYLDFLAGS="-Wl,-z,relro,-z,now" @@ -130,7 +122,7 @@ -DFLOATTEST=64bit \ %endif %{nil} -make %{?_smp_mflags} +%make_build %check %if %{asan_build} ++++++ libjpeg62-turbo.spec ++++++ --- /var/tmp/diff_new_pack.ArKpKn/_old 2020-08-15 21:18:05.819545142 +0200 +++ /var/tmp/diff_new_pack.ArKpKn/_new 2020-08-15 21:18:05.823545145 +0200 @@ -19,23 +19,19 @@ %define major 62 %define minor 3 %define micro 0 -%define srcver 2.0.4 +%define srcver 2.0.5 %define libver %{major}.%{minor}.%{micro} Name: libjpeg62-turbo Version: %{srcver} Release: 0 Summary: A SIMD-accelerated library for manipulating JPEG image files License: BSD-3-Clause -Group: Productivity/Graphics/Convertors -URL: http://sourceforge.net/projects/libjpeg-turbo +URL: https://sourceforge.net/projects/libjpeg-turbo Source0: http://downloads.sf.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz Source1: http://downloads.sf.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz.sig Source2: libjpeg-turbo.keyring Source3: baselibs.conf Patch1: libjpeg-turbo-1.3.0-tiff-ojpeg.patch -Patch2: ctest-depends.patch -# CVE-2020-13790 [bsc#1172491], heap-based buffer over-read in get_rgb_row() in rdppm.c via a malformed PPM input file -Patch3: libjpeg-turbo-CVE-2020-13790.patch BuildRequires: cmake BuildRequires: gcc-c++ # needed for tests as we remove the lib here @@ -53,7 +49,6 @@ Version: %{libver} Release: 0 Summary: A SIMD-accelerated JPEG compression/decompression library -Group: System/Libraries Obsoletes: libjpeg = 6.2.0 %description -n libjpeg%{major} @@ -65,7 +60,6 @@ Version: %{libver} Release: 0 Summary: Development Tools for applications which will use the Libjpeg Library -Group: Development/Libraries/C and C++ Requires: libjpeg%{major} = %{version} Conflicts: libjpeg-devel Provides: libjpeg-devel = %{version} @@ -79,8 +73,6 @@ %prep %setup -q -n libjpeg-turbo-%{srcver} %patch1 -%patch2 -p1 -%patch3 -p1 %build export LDFLAGS="-Wl,-z,relro,-z,now" @@ -90,7 +82,7 @@ -DFLOATTEST=64bit \ %endif %{nil} -make %{?_smp_mflags} +%make_build %check export LD_LIBRARY_PATH=%{buildroot}%{_libdir}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} ++++++ libjpeg-turbo-2.0.4.tar.gz -> libjpeg-turbo-2.0.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/CMakeLists.txt new/libjpeg-turbo-2.0.5/CMakeLists.txt --- old/libjpeg-turbo-2.0.4/CMakeLists.txt 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/CMakeLists.txt 2020-06-19 06:40:20.000000000 +0200 @@ -5,7 +5,7 @@ endif() project(libjpeg-turbo C) -set(VERSION 2.0.4) +set(VERSION 2.0.5) string(REPLACE "." ";" VERSION_TRIPLET ${VERSION}) list(GET VERSION_TRIPLET 0 VERSION_MAJOR) list(GET VERSION_TRIPLET 1 VERSION_MINOR) @@ -451,6 +451,21 @@ endif() message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})") +if(WITH_TURBOJPEG) + if(MSVC) + set(THREAD_LOCAL "__declspec(thread)") + else() + set(THREAD_LOCAL "__thread") + endif() + check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL) + if(HAVE_THREAD_LOCAL) + message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}") + else() + message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.") + unset(THREAD_LOCAL) + endif() +endif() + if(UNIX AND NOT APPLE) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };") set(CMAKE_REQUIRED_FLAGS @@ -888,12 +903,18 @@ set(suffix -static) endif() if(WITH_TURBOJPEG) - add_test(tjunittest-${libtype} tjunittest${suffix}) - add_test(tjunittest-${libtype}-alloc tjunittest${suffix} -alloc) - add_test(tjunittest-${libtype}-yuv tjunittest${suffix} -yuv) - add_test(tjunittest-${libtype}-yuv-alloc tjunittest${suffix} -yuv -alloc) - add_test(tjunittest-${libtype}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) - add_test(tjunittest-${libtype}-bmp tjunittest${suffix} -bmp) + add_test(tjunittest-${libtype} + ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix}) + add_test(tjunittest-${libtype}-alloc + ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -alloc) + add_test(tjunittest-${libtype}-yuv + ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -yuv) + add_test(tjunittest-${libtype}-yuv-alloc + ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -yuv -alloc) + add_test(tjunittest-${libtype}-yuv-nopad + ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -yuv -noyuvpad) + add_test(tjunittest-${libtype}-bmp + ${CMAKE_CROSSCOMPILING_EMULATOR} tjunittest${suffix} -bmp) set(MD5_PPM_GRAY_TILE 89d3ca21213d9d864b50b4e4e7de4ca6) set(MD5_PPM_420_8x8_TILE 847fceab15c5b7b911cb986cf0f71de3) @@ -918,22 +939,23 @@ ${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES}/testorig.ppm testout_tile.ppm) add_test(tjbench-${libtype}-tile - tjbench${suffix} testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 - -warmup 0) + ${CMAKE_CROSSCOMPILING_EMULATOR} tjbench${suffix} testout_tile.ppm 95 + -rgb -quiet -tile -benchtime 0.01 -warmup 0) set_tests_properties(tjbench-${libtype}-tile PROPERTIES DEPENDS tjbench-${libtype}-tile-cp) foreach(tile 8 16 32 64 128) add_test(tjbench-${libtype}-tile-gray-${tile}x${tile}-cmp - ${MD5CMP} ${MD5_PPM_GRAY_TILE} + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_GRAY_TILE} testout_tile_GRAY_Q95_${tile}x${tile}.ppm) foreach(subsamp 420 422) add_test(tjbench-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp - ${MD5CMP} ${MD5_PPM_${subsamp}_${tile}x${tile}_TILE} + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} + ${MD5_PPM_${subsamp}_${tile}x${tile}_TILE} testout_tile_${subsamp}_Q95_${tile}x${tile}.ppm) endforeach() add_test(tjbench-${libtype}-tile-444-${tile}x${tile}-cmp - ${MD5CMP} ${MD5_PPM_444_TILE} + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_444_TILE} testout_tile_444_Q95_${tile}x${tile}.ppm) foreach(subsamp gray 420 422 444) set_tests_properties(tjbench-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp @@ -945,19 +967,22 @@ ${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES}/testorig.ppm testout_tilem.ppm) add_test(tjbench-${libtype}-tilem - tjbench${suffix} testout_tilem.ppm 95 -rgb -fastupsample -quiet -tile - -benchtime 0.01 -warmup 0) + ${CMAKE_CROSSCOMPILING_EMULATOR} tjbench${suffix} testout_tilem.ppm 95 + -rgb -fastupsample -quiet -tile -benchtime 0.01 -warmup 0) set_tests_properties(tjbench-${libtype}-tilem PROPERTIES DEPENDS tjbench-${libtype}-tilem-cp) add_test(tjbench-${libtype}-tile-420m-8x8-cmp - ${MD5CMP} ${MD5_PPM_420M_8x8_TILE} testout_tilem_420_Q95_8x8.ppm) + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_420M_8x8_TILE} + testout_tilem_420_Q95_8x8.ppm) add_test(tjbench-${libtype}-tile-422m-8x8-cmp - ${MD5CMP} ${MD5_PPM_422M_8x8_TILE} testout_tilem_422_Q95_8x8.ppm) + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_422M_8x8_TILE} + testout_tilem_422_Q95_8x8.ppm) foreach(tile 16 32 64 128) foreach(subsamp 420 422) add_test(tjbench-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp - ${MD5CMP} ${MD5_PPM_${subsamp}M_TILE} + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} + ${MD5_PPM_${subsamp}M_TILE} testout_tilem_${subsamp}_Q95_${tile}x${tile}.ppm) endforeach() endforeach() @@ -975,9 +1000,10 @@ macro(add_bittest PROG NAME ARGS OUTFILE INFILE MD5SUM) add_test(${PROG}-${libtype}-${NAME} - ${PROG}${suffix} ${ARGS} -outfile ${OUTFILE} ${INFILE}) + ${CMAKE_CROSSCOMPILING_EMULATOR} ${PROG}${suffix} ${ARGS} + -outfile ${OUTFILE} ${INFILE}) add_test(${PROG}-${libtype}-${NAME}-cmp - ${MD5CMP} ${MD5SUM} ${OUTFILE}) + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5SUM} ${OUTFILE}) set_tests_properties(${PROG}-${libtype}-${NAME}-cmp PROPERTIES DEPENDS ${PROG}-${libtype}-${NAME}) if(${ARGC} GREATER 6) @@ -998,12 +1024,14 @@ ${MD5_PPM_RGB_ISLOW} cjpeg-${libtype}-rgb-islow) add_test(djpeg-${libtype}-rgb-islow-icc-cmp - ${MD5CMP} b06a39d730129122e85c1363ed1bbc9e testout_rgb_islow.icc) + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} + b06a39d730129122e85c1363ed1bbc9e testout_rgb_islow.icc) set_tests_properties(djpeg-${libtype}-rgb-islow-icc-cmp PROPERTIES DEPENDS djpeg-${libtype}-rgb-islow) add_bittest(jpegtran icc "-copy;all;-icc;${TESTIMAGES}/test2.icc" - testout_rgb_islow2.jpg testout_rgb_islow.jpg ${MD5_JPEG_RGB_ISLOW2}) + testout_rgb_islow2.jpg testout_rgb_islow.jpg + ${MD5_JPEG_RGB_ISLOW2} cjpeg-${libtype}-rgb-islow) if(NOT WITH_12BIT) # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff @@ -1216,7 +1244,7 @@ # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff add_test(cjpeg-${libtype}-420-islow-prog - cjpeg${suffix} -dct int -prog + ${CMAKE_CROSSCOMPILING_EMULATOR} cjpeg${suffix} -dct int -prog -outfile testout_420_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) add_bittest(djpeg 420-islow-prog-crop62x62_71_71 "-dct;int;-crop;62x62+71+71;-ppm" @@ -1233,7 +1261,7 @@ # Context rows: No Intra-iMCU row: Yes ENT: huff add_test(cjpeg-${libtype}-444-islow - cjpeg${suffix} -dct int -sample 1x1 + ${CMAKE_CROSSCOMPILING_EMULATOR} cjpeg${suffix} -dct int -sample 1x1 -outfile testout_444_islow.jpg ${TESTIMAGES}/testorig.ppm) add_bittest(djpeg 444-islow-skip1_6 "-dct;int;-skip;1,6;-ppm" testout_444_islow_skip1,6.ppm testout_444_islow.jpg @@ -1241,7 +1269,7 @@ # Context rows: No Intra-iMCU row: No ENT: prog huff add_test(cjpeg-${libtype}-444-islow-prog - cjpeg${suffix} -dct int -prog -sample 1x1 + ${CMAKE_CROSSCOMPILING_EMULATOR} cjpeg${suffix} -dct int -prog -sample 1x1 -outfile testout_444_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) add_bittest(djpeg 444-islow-prog-crop98x98_13_13 "-dct;int;-crop;98x98+13+13;-ppm" @@ -1251,8 +1279,9 @@ # Context rows: No Intra-iMCU row: No ENT: arith if(WITH_ARITH_ENC) add_test(cjpeg-${libtype}-444-islow-ari - cjpeg${suffix} -dct int -arithmetic -sample 1x1 - -outfile testout_444_islow_ari.jpg ${TESTIMAGES}/testorig.ppm) + ${CMAKE_CROSSCOMPILING_EMULATOR} cjpeg${suffix} -dct int -arithmetic + -sample 1x1 -outfile testout_444_islow_ari.jpg + ${TESTIMAGES}/testorig.ppm) if(WITH_ARITH_DEC) add_bittest(djpeg 444-islow-ari-crop37x37_0_0 "-dct;int;-crop;37x37+0+0;-ppm" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/ChangeLog.md new/libjpeg-turbo-2.0.5/ChangeLog.md --- old/libjpeg-turbo-2.0.4/ChangeLog.md 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/ChangeLog.md 2020-06-19 06:40:20.000000000 +0200 @@ -1,3 +1,33 @@ +2.0.5 +===== + +### Significant changes relative to 2.0.4: + +1. Worked around issues in the MIPS DSPr2 SIMD extensions that caused failures +in the libjpeg-turbo regression tests. Specifically, the +`jsimd_h2v1_downsample_dspr2()` and `jsimd_h2v2_downsample_dspr2()` functions +in the MIPS DSPr2 SIMD extensions are now disabled until/unless they can be +fixed, and other functions that are incompatible with big endian MIPS CPUs are +disabled when building libjpeg-turbo for such CPUs. + +2. Fixed an oversight in the `TJCompressor.compress(int)` method in the +TurboJPEG Java API that caused an error ("java.lang.IllegalStateException: No +source image is associated with this instance") when attempting to use that +method to compress a YUV image. + +3. Fixed an issue (CVE-2020-13790) in the PPM reader that caused a buffer +overrun in cjpeg, TJBench, or the `tjLoadImage()` function if one of the values +in a binary PPM/PGM input file exceeded the maximum value defined in the file's +header and that maximum value was less than 255. libjpeg-turbo 1.5.0 already +included a similar fix for binary PPM/PGM files with maximum values greater +than 255. + +4. The TurboJPEG API library's global error handler, which is used in functions +such as `tjBufSize()` and `tjLoadImage()` that do not require a TurboJPEG +instance handle, is now thread-safe on platforms that support thread-local +storage. + + 2.0.4 ===== @@ -562,10 +592,10 @@ 3. Fixed a couple of issues in the PPM reader that would cause buffer overruns in cjpeg if one of the values in a binary PPM/PGM input file exceeded the -maximum value defined in the file's header. libjpeg-turbo 1.4.2 already -included a similar fix for ASCII PPM/PGM files. Note that these issues were -not security bugs, since they were confined to the cjpeg program and did not -affect any of the libjpeg-turbo libraries. +maximum value defined in the file's header and that maximum value was greater +than 255. libjpeg-turbo 1.4.2 already included a similar fix for ASCII PPM/PGM +files. Note that these issues were not security bugs, since they were confined +to the cjpeg program and did not affect any of the libjpeg-turbo libraries. 4. Fixed an issue whereby attempting to decompress a JPEG file with a corrupt header using the `tjDecompressToYUV2()` function would cause the function to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/LICENSE.md new/libjpeg-turbo-2.0.5/LICENSE.md --- old/libjpeg-turbo-2.0.4/LICENSE.md 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/LICENSE.md 2020-06-19 06:40:20.000000000 +0200 @@ -91,7 +91,7 @@ The Modified (3-clause) BSD License =================================== -Copyright (C)2009-2019 D. R. Commander. All Rights Reserved. +Copyright (C)2009-2020 D. R. Commander. All Rights Reserved. Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/cjpeg.c new/libjpeg-turbo-2.0.5/cjpeg.c --- old/libjpeg-turbo-2.0.4/cjpeg.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/cjpeg.c 2020-06-19 06:40:20.000000000 +0200 @@ -682,12 +682,10 @@ if (memdst) { fprintf(stderr, "Compressed size: %lu bytes\n", outsize); - if (outbuffer != NULL) - free(outbuffer); + free(outbuffer); } - if (icc_profile != NULL) - free(icc_profile); + free(icc_profile); /* All done. */ exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/djpeg.c new/libjpeg-turbo-2.0.5/djpeg.c --- old/libjpeg-turbo-2.0.4/djpeg.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/djpeg.c 2020-06-19 06:40:20.000000000 +0200 @@ -813,7 +813,7 @@ end_progress_monitor((j_common_ptr)&cinfo); #endif - if (memsrc && inbuffer != NULL) + if (memsrc) free(inbuffer); /* All done. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/doc/html/group___turbo_j_p_e_g.html new/libjpeg-turbo-2.0.5/doc/html/group___turbo_j_p_e_g.html --- old/libjpeg-turbo-2.0.4/doc/html/group___turbo_j_p_e_g.html 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/doc/html/group___turbo_j_p_e_g.html 2020-06-19 06:40:20.000000000 +0200 @@ -2078,7 +2078,7 @@ <p>You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by the compression and transform functions or that were manually allocated using <a class="el" href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> - <tr><td class="paramname">buffer</td><td>address of the buffer to free</td></tr> + <tr><td class="paramname">buffer</td><td>address of the buffer to free. If the address is NULL, then this function has no effect.</td></tr> </table> </dd> </dl> @@ -2129,7 +2129,7 @@ <p>Returns a descriptive error message explaining why the last command failed. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> - <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor, or transformer instance, or NULL if the error was generated by a global function (but note that retrieving the error message for a global function is not thread-safe.)</td></tr> + <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor, or transformer instance, or NULL if the error was generated by a global function (but note that retrieving the error message for a global function is thread-safe only on platforms that support thread-local storage.)</td></tr> </table> </dd> </dl> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJCompressor.java new/libjpeg-turbo-2.0.5/java/org/libjpegturbo/turbojpeg/TJCompressor.java --- old/libjpeg-turbo-2.0.4/java/org/libjpegturbo/turbojpeg/TJCompressor.java 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/java/org/libjpegturbo/turbojpeg/TJCompressor.java 2020-06-19 06:40:20.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (C)2011-2015, 2018 D. R. Commander. All Rights Reserved. + * Copyright (C)2011-2015, 2018, 2020 D. R. Commander. All Rights Reserved. * Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without @@ -377,8 +377,15 @@ * #getCompressedSize} to obtain the size of the JPEG image. */ public byte[] compress(int flags) throws TJException { - checkSourceImage(); - byte[] buf = new byte[TJ.bufSize(srcWidth, srcHeight, subsamp)]; + byte[] buf; + if (srcYUVImage != null) { + buf = new byte[TJ.bufSize(srcYUVImage.getWidth(), + srcYUVImage.getHeight(), + srcYUVImage.getSubsamp())]; + } else { + checkSourceImage(); + buf = new byte[TJ.bufSize(srcWidth, srcHeight, subsamp)]; + } compress(buf, flags); return buf; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/jconfigint.h.in new/libjpeg-turbo-2.0.5/jconfigint.h.in --- old/libjpeg-turbo-2.0.4/jconfigint.h.in 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/jconfigint.h.in 2020-06-19 06:40:20.000000000 +0200 @@ -7,6 +7,9 @@ /* How to obtain function inlining. */ #define INLINE @INLINE@ +/* How to obtain thread-local storage */ +#define THREAD_LOCAL @THREAD_LOCAL@ + /* Define to the full name of this package. */ #define PACKAGE_NAME "@CMAKE_PROJECT_NAME@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/jdatadst-tj.c new/libjpeg-turbo-2.0.5/jdatadst-tj.c --- old/libjpeg-turbo-2.0.4/jdatadst-tj.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/jdatadst-tj.c 2020-06-19 06:40:20.000000000 +0200 @@ -103,8 +103,7 @@ MEMCOPY(nextbuffer, dest->buffer, dest->bufsize); - if (dest->newbuffer != NULL) - free(dest->newbuffer); + free(dest->newbuffer); dest->newbuffer = nextbuffer; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/jdatadst.c new/libjpeg-turbo-2.0.5/jdatadst.c --- old/libjpeg-turbo-2.0.4/jdatadst.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/jdatadst.c 2020-06-19 06:40:20.000000000 +0200 @@ -143,8 +143,7 @@ MEMCOPY(nextbuffer, dest->buffer, dest->bufsize); - if (dest->newbuffer != NULL) - free(dest->newbuffer); + free(dest->newbuffer); dest->newbuffer = nextbuffer; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/jpegtran.c new/libjpeg-turbo-2.0.5/jpegtran.c --- old/libjpeg-turbo-2.0.4/jpegtran.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/jpegtran.c 2020-06-19 06:40:20.000000000 +0200 @@ -591,8 +591,7 @@ end_progress_monitor((j_common_ptr)&dstinfo); #endif - if (icc_profile != NULL) - free(icc_profile); + free(icc_profile); /* All done. */ exit(jsrcerr.num_warnings + jdsterr.num_warnings ? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/jversion.h new/libjpeg-turbo-2.0.5/jversion.h --- old/libjpeg-turbo-2.0.4/jversion.h 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/jversion.h 2020-06-19 06:40:20.000000000 +0200 @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2010, 2012-2019, D. R. Commander. + * Copyright (C) 2010, 2012-2020, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -36,7 +36,7 @@ */ #define JCOPYRIGHT \ - "Copyright (C) 2009-2019 D. R. Commander\n" \ + "Copyright (C) 2009-2020 D. R. Commander\n" \ "Copyright (C) 2011-2016 Siarhei Siamashka\n" \ "Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \ "Copyright (C) 2015 Intel Corporation\n" \ @@ -49,4 +49,4 @@ "Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding" #define JCOPYRIGHT_SHORT \ - "Copyright (C) 1991-2019 The libjpeg-turbo Project and many others" + "Copyright (C) 1991-2020 The libjpeg-turbo Project and many others" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/rdppm.c new/libjpeg-turbo-2.0.5/rdppm.c --- old/libjpeg-turbo-2.0.4/rdppm.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/rdppm.c 2020-06-19 06:40:20.000000000 +0200 @@ -5,7 +5,7 @@ * Copyright (C) 1991-1997, Thomas G. Lane. * Modified 2009 by Bill Allombert, Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2015-2017, D. R. Commander. + * Copyright (C) 2015-2017, 2020, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -720,7 +720,7 @@ /* On 16-bit-int machines we have to be careful of maxval = 65535 */ source->rescale = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, - (size_t)(((long)maxval + 1L) * + (size_t)(((long)MAX(maxval, 255) + 1L) * sizeof(JSAMPLE))); half_maxval = maxval / 2; for (val = 0; val <= (long)maxval; val++) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/rdswitch.c new/libjpeg-turbo-2.0.5/rdswitch.c --- old/libjpeg-turbo-2.0.4/rdswitch.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/rdswitch.c 2020-06-19 06:40:20.000000000 +0200 @@ -338,8 +338,8 @@ #else q_scale_factor[tblno] = jpeg_quality_scaling(val); #endif - while (*arg && *arg++ != ',') /* advance to next segment of arg string */ - ; + while (*arg && *arg++ != ','); /* advance to next segment of arg + string */ } else { /* reached end of parameter, set remaining factors to last value */ #if JPEG_LIB_VERSION >= 70 @@ -378,8 +378,8 @@ return FALSE; } cinfo->comp_info[ci].quant_tbl_no = val; - while (*arg && *arg++ != ',') /* advance to next segment of arg string */ - ; + while (*arg && *arg++ != ','); /* advance to next segment of arg + string */ } else { /* reached end of parameter, set remaining components to last table */ cinfo->comp_info[ci].quant_tbl_no = val; @@ -412,8 +412,8 @@ } cinfo->comp_info[ci].h_samp_factor = val1; cinfo->comp_info[ci].v_samp_factor = val2; - while (*arg && *arg++ != ',') /* advance to next segment of arg string */ - ; + while (*arg && *arg++ != ','); /* advance to next segment of arg + string */ } else { /* reached end of parameter, set remaining components to 1x1 sampling */ cinfo->comp_info[ci].h_samp_factor = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/release/makemacpkg.in new/libjpeg-turbo-2.0.5/release/makemacpkg.in --- old/libjpeg-turbo-2.0.4/release/makemacpkg.in 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/release/makemacpkg.in 2020-06-19 06:40:20.000000000 +0200 @@ -230,7 +230,7 @@ install_ios $BUILDDIRARMV7S ARMv7s armv7s arm fi -if [ $UNIVERSAL = 1 -a "BUILDDIRARMV8" != "" ]; then +if [ $UNIVERSAL = 1 -a "$BUILDDIRARMV8" != "" ]; then install_ios $BUILDDIRARMV8 ARMv8 armv8 arm64 fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/simd/mips/jsimd.c new/libjpeg-turbo-2.0.5/simd/mips/jsimd.c --- old/libjpeg-turbo-2.0.4/simd/mips/jsimd.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/simd/mips/jsimd.c 2020-06-19 06:40:20.000000000 +0200 @@ -2,7 +2,7 @@ * jsimd_mips.c * * Copyright 2009 Pierre Ossman <[email protected]> for Cendio AB - * Copyright (C) 2009-2011, 2014, 2016, 2018, D. R. Commander. + * Copyright (C) 2009-2011, 2014, 2016, 2018, 2020, D. R. Commander. * Copyright (C) 2013-2014, MIPS Technologies, Inc., California. * Copyright (C) 2015-2016, 2018, Matthieu Darbois. * @@ -29,9 +29,9 @@ static unsigned int simd_support = ~0; -#if defined(__linux__) +#if !(defined(__mips_dsp) && (__mips_dsp_rev >= 2)) && defined(__linux__) -LOCAL(int) +LOCAL(void) parse_proc_cpuinfo(const char *search_string) { const char *file_name = "/proc/cpuinfo"; @@ -45,13 +45,12 @@ if (strstr(cpuinfo_line, search_string) != NULL) { fclose(f); simd_support |= JSIMD_DSPR2; - return 1; + return; } } fclose(f); } /* Did not find string in the proc file, or not Linux ELF. */ - return 0; } #endif @@ -73,14 +72,13 @@ simd_support = 0; -#if defined(__MIPSEL__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#if defined(__mips_dsp) && (__mips_dsp_rev >= 2) simd_support |= JSIMD_DSPR2; #elif defined(__linux__) /* We still have a chance to use MIPS DSPR2 regardless of globally used * -mdspr2 options passed to gcc by performing runtime detection via * /proc/cpuinfo parsing on linux */ - if (!parse_proc_cpuinfo("MIPS 74K")) - return; + parse_proc_cpuinfo("MIPS 74K"); #endif #ifndef NO_GETENV @@ -340,8 +338,13 @@ if (sizeof(JDIMENSION) != 4) return 0; + /* FIXME: jsimd_h2v2_downsample_dspr2() fails some of the TJBench tiling + * regression tests, probably because the DSPr2 SIMD implementation predates + * those tests. */ +#if 0 if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -376,8 +379,13 @@ if (sizeof(JDIMENSION) != 4) return 0; + /* FIXME: jsimd_h2v1_downsample_dspr2() fails some of the TJBench tiling + * regression tests, probably because the DSPr2 SIMD implementation predates + * those tests. */ +#if 0 if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -441,8 +449,10 @@ if (sizeof(JDIMENSION) != 4) return 0; +#if defined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -503,8 +513,10 @@ if (sizeof(JDIMENSION) != 4) return 0; +#if defined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -520,8 +532,10 @@ if (sizeof(JDIMENSION) != 4) return 0; +#if defined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -669,8 +683,10 @@ if (sizeof(DCTELEM) != 2) return 0; +#if defined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -727,8 +743,10 @@ if (sizeof(DCTELEM) != 2) return 0; +#if defined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -744,8 +762,10 @@ if (sizeof(DCTELEM) != 2) return 0; +#if defined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -872,8 +892,10 @@ if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; +#if defined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } @@ -1017,8 +1039,10 @@ if (IFAST_SCALE_BITS != 2) return 0; +#if defined(__MIPSEL__) if (simd_support & JSIMD_DSPR2) return 1; +#endif return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/tjbench.c new/libjpeg-turbo-2.0.5/tjbench.c --- old/libjpeg-turbo-2.0.4/tjbench.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/tjbench.c 2020-06-19 06:40:20.000000000 +0200 @@ -304,8 +304,8 @@ bailout: if (file) fclose(file); if (handle) tjDestroy(handle); - if (dstBuf && dstBufAlloc) free(dstBuf); - if (yuvBuf) free(yuvBuf); + if (dstBufAlloc) free(dstBuf); + free(yuvBuf); return retval; } @@ -489,7 +489,7 @@ } else if (quiet == 1) printf("N/A\n"); for (i = 0; i < ntilesw * ntilesh; i++) { - if (jpegBuf[i]) tjFree(jpegBuf[i]); + tjFree(jpegBuf[i]); jpegBuf[i] = NULL; } free(jpegBuf); jpegBuf = NULL; @@ -502,18 +502,16 @@ } bailout: - if (file) { fclose(file); file = NULL; } + if (file) fclose(file); if (jpegBuf) { - for (i = 0; i < ntilesw * ntilesh; i++) { - if (jpegBuf[i]) tjFree(jpegBuf[i]); - jpegBuf[i] = NULL; - } - free(jpegBuf); jpegBuf = NULL; + for (i = 0; i < ntilesw * ntilesh; i++) + tjFree(jpegBuf[i]); } - if (yuvBuf) { free(yuvBuf); yuvBuf = NULL; } - if (jpegSize) { free(jpegSize); jpegSize = NULL; } - if (tmpBuf) { free(tmpBuf); tmpBuf = NULL; } - if (handle) { tjDestroy(handle); handle = NULL; } + free(jpegBuf); + free(yuvBuf); + free(jpegSize); + free(tmpBuf); + if (handle) tjDestroy(handle); return retval; } @@ -701,7 +699,7 @@ } } else { if (quiet == 1) printf("N/A N/A "); - if (jpegBuf[0]) tjFree(jpegBuf[0]); + tjFree(jpegBuf[0]); jpegBuf[0] = NULL; decompsrc = 1; } @@ -716,27 +714,25 @@ } else if (quiet == 1) printf("N/A\n"); for (i = 0; i < ntilesw * ntilesh; i++) { - if (jpegBuf[i]) tjFree(jpegBuf[i]); + tjFree(jpegBuf[i]); jpegBuf[i] = NULL; } free(jpegBuf); jpegBuf = NULL; - if (jpegSize) { free(jpegSize); jpegSize = NULL; } + free(jpegSize); jpegSize = NULL; if (tilew == w && tileh == h) break; } bailout: - if (file) { fclose(file); file = NULL; } + if (file) fclose(file); if (jpegBuf) { - for (i = 0; i < ntilesw * ntilesh; i++) { - if (jpegBuf[i]) tjFree(jpegBuf[i]); - jpegBuf[i] = NULL; - } - free(jpegBuf); jpegBuf = NULL; + for (i = 0; i < ntilesw * ntilesh; i++) + tjFree(jpegBuf[i]); } - if (jpegSize) { free(jpegSize); jpegSize = NULL; } - if (srcBuf) { free(srcBuf); srcBuf = NULL; } - if (t) { free(t); t = NULL; } + free(jpegBuf); + free(jpegSize); + free(srcBuf); + free(t); if (handle) { tjDestroy(handle); handle = NULL; } return retval; } @@ -1026,6 +1022,6 @@ } bailout: - if (srcBuf) tjFree(srcBuf); + tjFree(srcBuf); return retval; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/tjexample.c new/libjpeg-turbo-2.0.5/tjexample.c --- old/libjpeg-turbo-2.0.4/tjexample.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/tjexample.c 2020-06-19 06:40:20.000000000 +0200 @@ -388,9 +388,9 @@ } bailout: - if (imgBuf) tjFree(imgBuf); + tjFree(imgBuf); if (tjInstance) tjDestroy(tjInstance); - if (jpegBuf) tjFree(jpegBuf); + tjFree(jpegBuf); if (jpegFile) fclose(jpegFile); return retval; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/tjunittest.c new/libjpeg-turbo-2.0.5/tjunittest.c --- old/libjpeg-turbo-2.0.4/tjunittest.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/tjunittest.c 2020-06-19 06:40:20.000000000 +0200 @@ -410,8 +410,8 @@ printf("Done.\n Result in %s\n", tempStr); bailout: - if (yuvBuf) free(yuvBuf); - if (srcBuf) free(srcBuf); + free(yuvBuf); + free(srcBuf); } @@ -478,8 +478,8 @@ printf("\n"); bailout: - if (yuvBuf) free(yuvBuf); - if (dstBuf) free(dstBuf); + free(yuvBuf); + free(dstBuf); } @@ -550,7 +550,7 @@ bailout: if (chandle) tjDestroy(chandle); if (dhandle) tjDestroy(dhandle); - if (dstBuf) tjFree(dstBuf); + tjFree(dstBuf); } @@ -665,8 +665,8 @@ printf("Done. \n"); bailout: - if (srcBuf) free(srcBuf); - if (dstBuf) tjFree(dstBuf); + free(srcBuf); + tjFree(dstBuf); if (handle) tjDestroy(handle); } @@ -839,7 +839,7 @@ unlink(filename); bailout: - if (buf) tjFree(buf); + tjFree(buf); if (exitStatus < 0) return exitStatus; return retval; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/turbojpeg-jni.c new/libjpeg-turbo-2.0.5/turbojpeg-jni.c --- old/libjpeg-turbo-2.0.4/turbojpeg-jni.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/turbojpeg-jni.c 2020-06-19 06:40:20.000000000 +0200 @@ -1232,9 +1232,9 @@ free(dstBufs); } SAFE_RELEASE(jsrcBuf, jpegBuf); - if (jdstBufs) free(jdstBufs); - if (dstSizes) free(dstSizes); - if (t) free(t); + free(jdstBufs); + free(dstSizes); + free(t); return jdstSizes; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/turbojpeg.c new/libjpeg-turbo-2.0.5/turbojpeg.c --- old/libjpeg-turbo-2.0.4/turbojpeg.c 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/turbojpeg.c 2020-06-19 06:40:20.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2019 D. R. Commander. All Rights Reserved. + * Copyright (C)2009-2020 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: @@ -43,6 +43,7 @@ #include "transupp.h" #include "./jpegcomp.h" #include "./cdjpeg.h" +#include "jconfigint.h" extern void jpeg_mem_dest_tj(j_compress_ptr, unsigned char **, unsigned long *, boolean); @@ -55,7 +56,7 @@ /* Error handling (based on example in example.txt) */ -static char errStr[JMSG_LENGTH_MAX] = "No error"; +static THREAD_LOCAL char errStr[JMSG_LENGTH_MAX] = "No error"; struct my_error_mgr { struct jpeg_error_mgr pub; @@ -432,7 +433,7 @@ DLLEXPORT void tjFree(unsigned char *buf) { - if (buf) free(buf); + free(buf); } @@ -462,7 +463,7 @@ if (setjmp(this->jerr.setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error. */ - if (this) free(this); + free(this); return NULL; } @@ -692,7 +693,7 @@ bailout: if (cinfo->global_state > CSTATE_START) jpeg_abort_compress(cinfo); - if (row_pointer) free(row_pointer); + free(row_pointer); if (this->jerr.warning) retval = -1; this->jerr.stopOnWarning = FALSE; return retval; @@ -866,13 +867,13 @@ bailout: if (cinfo->global_state > CSTATE_START) jpeg_abort_compress(cinfo); - if (row_pointer) free(row_pointer); + free(row_pointer); for (i = 0; i < MAX_COMPONENTS; i++) { - if (tmpbuf[i] != NULL) free(tmpbuf[i]); - if (_tmpbuf[i] != NULL) free(_tmpbuf[i]); - if (tmpbuf2[i] != NULL) free(tmpbuf2[i]); - if (_tmpbuf2[i] != NULL) free(_tmpbuf2[i]); - if (outbuf[i] != NULL) free(outbuf[i]); + free(tmpbuf[i]); + free(_tmpbuf[i]); + free(tmpbuf2[i]); + free(_tmpbuf2[i]); + free(outbuf[i]); } if (this->jerr.warning) retval = -1; this->jerr.stopOnWarning = FALSE; @@ -1062,10 +1063,10 @@ bailout: if (cinfo->global_state > CSTATE_START) jpeg_abort_compress(cinfo); for (i = 0; i < MAX_COMPONENTS; i++) { - if (tmpbuf[i]) free(tmpbuf[i]); - if (inbuf[i]) free(inbuf[i]); + free(tmpbuf[i]); + free(inbuf[i]); } - if (_tmpbuf) free(_tmpbuf); + free(_tmpbuf); if (this->jerr.warning) retval = -1; this->jerr.stopOnWarning = FALSE; return retval; @@ -1130,7 +1131,7 @@ if (setjmp(this->jerr.setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error. */ - if (this) free(this); + free(this); return NULL; } @@ -1313,7 +1314,7 @@ bailout: if (dinfo->global_state > DSTATE_START) jpeg_abort_decompress(dinfo); - if (row_pointer) free(row_pointer); + free(row_pointer); if (this->jerr.warning) retval = -1; this->jerr.stopOnWarning = FALSE; return retval; @@ -1519,11 +1520,11 @@ bailout: if (dinfo->global_state > DSTATE_START) jpeg_abort_decompress(dinfo); - if (row_pointer) free(row_pointer); + free(row_pointer); for (i = 0; i < MAX_COMPONENTS; i++) { - if (tmpbuf[i] != NULL) free(tmpbuf[i]); - if (_tmpbuf[i] != NULL) free(_tmpbuf[i]); - if (inbuf[i] != NULL) free(inbuf[i]); + free(tmpbuf[i]); + free(_tmpbuf[i]); + free(inbuf[i]); } if (this->jerr.warning) retval = -1; this->jerr.stopOnWarning = FALSE; @@ -1731,10 +1732,10 @@ bailout: if (dinfo->global_state > DSTATE_START) jpeg_abort_decompress(dinfo); for (i = 0; i < MAX_COMPONENTS; i++) { - if (tmpbuf[i]) free(tmpbuf[i]); - if (outbuf[i]) free(outbuf[i]); + free(tmpbuf[i]); + free(outbuf[i]); } - if (_tmpbuf) free(_tmpbuf); + free(_tmpbuf); if (this->jerr.warning) retval = -1; this->jerr.stopOnWarning = FALSE; return retval; @@ -1979,7 +1980,7 @@ bailout: if (cinfo->global_state > CSTATE_START) jpeg_abort_compress(cinfo); if (dinfo->global_state > DSTATE_START) jpeg_abort_decompress(dinfo); - if (xinfo) free(xinfo); + free(xinfo); if (this->jerr.warning) retval = -1; this->jerr.stopOnWarning = FALSE; return retval; @@ -2074,7 +2075,7 @@ bailout: if (handle) tjDestroy(handle); if (file) fclose(file); - if (retval < 0 && dstBuf) { free(dstBuf); dstBuf = NULL; } + if (retval < 0) { free(dstBuf); dstBuf = NULL; } return dstBuf; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libjpeg-turbo-2.0.4/turbojpeg.h new/libjpeg-turbo-2.0.5/turbojpeg.h --- old/libjpeg-turbo-2.0.4/turbojpeg.h 2019-12-31 08:10:30.000000000 +0100 +++ new/libjpeg-turbo-2.0.5/turbojpeg.h 2020-06-19 06:40:20.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2015, 2017 D. R. Commander. All Rights Reserved. + * Copyright (C)2009-2015, 2017, 2020 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: @@ -1636,7 +1636,8 @@ * (re)allocated by the compression and transform functions or that were * manually allocated using #tjAlloc(). * - * @param buffer address of the buffer to free + * @param buffer address of the buffer to free. If the address is NULL, then + * this function has no effect. * * @sa tjAlloc() */ @@ -1649,7 +1650,7 @@ * @param handle a handle to a TurboJPEG compressor, decompressor, or * transformer instance, or NULL if the error was generated by a global * function (but note that retrieving the error message for a global function - * is not thread-safe.) + * is thread-safe only on platforms that support thread-local storage.) * * @return a descriptive error message explaining why the last command failed. */
