From: DRC Date: Thu, 19 Jan 2017 23:50:59 +0000 (-0600) Subject: Fix error w/ lossless crop & libjpeg v7 emulation X-Git-Tag: 1.5.2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22527955717f4640e6a81e91632dc763e8a081fc;p=libjpeg-turbo Fix error w/ lossless crop & libjpeg v7 emulation The JPEG_LIB_VERSION #ifdef in jtransform_adjust_parameters() was incorrect, which caused a "Bogus virtual array access" error when attempting to use the lossless crop feature. Introduced in c04bd3cc97f44fd9030de1e141754c8775d4e5a5. This also adds libjpeg v7 API/ABI emulation to the Travis CI tests. --- diff --git a/.travis.yml b/.travis.yml index 49656d8..53ded2b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,13 @@ matrix: - os: linux compiler: gcc env: CONFIGURE_FLAGS="--with-12bit" + - os: linux + compiler: gcc + env: CONFIGURE_FLAGS="--with-jpeg7" + addons: + apt: + packages: + - nasm - os: linux compiler: gcc env: CONFIGURE_FLAGS="--with-jpeg8" diff --git a/ChangeLog.md b/ChangeLog.md index 93b6687..59ae7f9 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -22,6 +22,12 @@ source/destination managers. Due to an oversight, the `jpeg_skip_scanlines()` and `jpeg_crop_scanlines()` functions were not being included in jpeg7.dll when libjpeg-turbo was built with `-DWITH_JPEG7=1` and `-DWITH_MEMSRCDST=1`. +6. Fixed "Bogus virtual array access" error that occurred when using the +lossless crop feature in jpegtran or the TurboJPEG API, if libjpeg-turbo was +built with libjpeg v7 API/ABI emulation. This was apparently a long-standing +bug that has existed since the introduction of libjpeg v7/v8 API/ABI emulation +in libjpeg-turbo v1.1. + 1.5.1 ===== diff --git a/transupp.c b/transupp.c index d1c56c6..0d915ef 100644 --- a/transupp.c +++ b/transupp.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2010, D. R. Commander. + * Copyright (C) 2010, 2017, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -1384,7 +1384,7 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo, /* Correct the destination's image dimensions as necessary * for rotate/flip, resize, and crop operations. */ -#if JPEG_LIB_VERSION >= 70 +#if JPEG_LIB_VERSION >= 80 dstinfo->jpeg_width = info->output_width; dstinfo->jpeg_height = info->output_height; #endif @@ -1395,14 +1395,14 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo, case JXFORM_TRANSVERSE: case JXFORM_ROT_90: case JXFORM_ROT_270: -#if JPEG_LIB_VERSION < 70 +#if JPEG_LIB_VERSION < 80 dstinfo->image_width = info->output_height; dstinfo->image_height = info->output_width; #endif transpose_critical_parameters(dstinfo); break; default: -#if JPEG_LIB_VERSION < 70 +#if JPEG_LIB_VERSION < 80 dstinfo->image_width = info->output_width; dstinfo->image_height = info->output_height; #endif