Debian

Available patches from Ubuntu

To see Ubuntu differences wrt. to Debian, write down a grep-dctrl query identifying the packages you're interested in:
grep-dctrl -n -sPackage Sources.Debian
(e.g. -FPackage linux-ntfs or linux-ntfs)

Modified packages are listed below:

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: ghostscript

ghostscript (9.22~dfsg+1-0ubuntu1.1) bionic-security; urgency=medium * SECURITY UPDATE: Heap-based buffer overflow and application crash - debian/patches/CVE-2016-10317.patch: check max_height bounds in base/gxht_thresh.c, base/gxipixel.c. - CVE-2016-10317 * SECURITY UPDATE: Denial of service - debian/patches/CVE-2018-10194.patch: avoid infinite number in devices/vector/gdevpdts.c. - CVE-2018-10194 -- Leonidas S. Barbosa <leo.barbosa@canonical.com> Tue, 24 Apr 2018 14:34:45 -0300 ghostscript (9.22~dfsg+1-0ubuntu1) bionic; urgency=low * Merge from Debian unstable. Remaining changes: + openjpeg library bundled with upstream Ghostscript/GhostPDL used instead of the original openjpeg library, as the original library is not accepted into Ubuntu Main (https://bugs.launchpad.net/bugs/711061). * debian/libgs9.symbols: Updated for new upstream source. Applied patch which dpkg-gensymbols generated. -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 23 Feb 2018 21:12:00 +0100

Modifications :
  1. Download patch openjpeg/src/lib/openjp2/dwt.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/dwt.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/dwt.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,125 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_DWT_H +#define OPJ_DWT_H +/** +@file dwt.h +@brief Implementation of a discrete wavelet transform (DWT) + +The functions in DWT.C have for goal to realize forward and inverse discret wavelet +transform with filter 5-3 (reversible) and filter 9-7 (irreversible). The functions in +DWT.C are used by some function in TCD.C. +*/ + +/** @defgroup DWT DWT - Implementation of a discrete wavelet transform */ +/*@{*/ + + +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ +/** +Forward 5-3 wavelet transform in 2-D. +Apply a reversible DWT transform to a component of an image. +@param tilec Tile component information (current tile) +*/ +OPJ_BOOL opj_dwt_encode(opj_tcd_tilecomp_t * tilec); + +/** +Inverse 5-3 wavelet transform in 2-D. +Apply a reversible inverse DWT transform to a component of an image. +@param tp Thread pool +@param tilec Tile component information (current tile) +@param numres Number of resolution levels to decode +*/ +OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, + OPJ_UINT32 numres); + +/** +Get the gain of a subband for the reversible 5-3 DWT. +@param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH) +@return Returns 0 if orient = 0, returns 1 if orient = 1 or 2, returns 2 otherwise +*/ +OPJ_UINT32 opj_dwt_getgain(OPJ_UINT32 orient) ; +/** +Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT. +@param level Level of the wavelet function +@param orient Band of the wavelet function +@return Returns the norm of the wavelet function +*/ +OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient); +/** +Forward 9-7 wavelet transform in 2-D. +Apply an irreversible DWT transform to a component of an image. +@param tilec Tile component information (current tile) +*/ +OPJ_BOOL opj_dwt_encode_real(opj_tcd_tilecomp_t * tilec); +/** +Inverse 9-7 wavelet transform in 2-D. +Apply an irreversible inverse DWT transform to a component of an image. +@param tilec Tile component information (current tile) +@param numres Number of resolution levels to decode +*/ +OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* OPJ_RESTRICT tilec, + OPJ_UINT32 numres); + +/** +Get the gain of a subband for the irreversible 9-7 DWT. +@param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH) +@return Returns the gain of the 9-7 wavelet transform +*/ +OPJ_UINT32 opj_dwt_getgain_real(OPJ_UINT32 orient); +/** +Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT +@param level Level of the wavelet function +@param orient Band of the wavelet function +@return Returns the norm of the 9-7 wavelet +*/ +OPJ_FLOAT64 opj_dwt_getnorm_real(OPJ_UINT32 level, OPJ_UINT32 orient); +/** +Explicit calculation of the Quantization Stepsizes +@param tccp Tile-component coding parameters +@param prec Precint analyzed +*/ +void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec); +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_DWT_H */
  2. Download patch openjpeg/src/lib/openjp2/opj_config_private.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_config_private.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_config_private.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,35 @@ +/* create opj_config_private.h for CMake */ + +/*** SET BY GS CONFIGURE SCRIPT ****/ +/* #define OPJ_HAVE_INTTYPES_H 1 */ + +#define OPJ_PACKAGE_VERSION "2.2.0" + +/* Not used by openjp2*/ +/*#define HAVE_MEMORY_H 1*/ +/*#define HAVE_STDLIB_H 1*/ +/*#define HAVE_STRINGS_H 1*/ +/*#define HAVE_STRING_H 1*/ +/*#define HAVE_SYS_STAT_H 1*/ +/*#define HAVE_SYS_TYPES_H 1 */ +/*#define HAVE_UNISTD_H 1*/ + +/* #undef _LARGEFILE_SOURCE */ +/* #undef _LARGE_FILES */ +/* #undef _FILE_OFFSET_BITS */ + +/*** SET BY GS CONFIGURE SCRIPT ****/ +/* #define OPJ_HAVE_FSEEKO ON */ + +/* Byte order. */ +/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or +__LITTLE_ENDIAN__ to match the endianness of the architecture being +compiled for. This is not necessarily the same as the architecture of the +machine doing the building. In order to support Universal Binaries on +Mac OS X, we prefer those defines to decide the endianness. +On other platforms we use the result of the TRY_RUN. */ +#if !defined(__APPLE__) +/* #undef OPJ_BIG_ENDIAN */ +#elif defined(__BIG_ENDIAN__) +# define OPJ_BIG_ENDIAN +#endif
  3. Download patch openjpeg/src/lib/openjp2/bio.c
  4. Download patch debian/libgs9.symbols
  5. Download patch openjpeg/src/lib/openjp2/thix_manager.c

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/thix_manager.c 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/thix_manager.c 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,146 @@ +/* + * $Id: thix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $ + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2003-2004, Yannick Verschueren + * Copyright (c) 2010-2011, Kaori Hagihara + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*! \file + * \brief Modification of jpip.c from 2KAN indexer + */ + +#include "opj_includes.h" + + + +int opj_write_thix(int coff, opj_codestream_info_t cstr_info, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager) +{ + OPJ_BYTE l_data_header [4]; + int i; + int tileno; + opj_jp2_box_t *box; + OPJ_UINT32 len; + OPJ_OFF_T lenp; + + lenp = 0; + box = (opj_jp2_box_t *)opj_calloc((size_t)(cstr_info.tw * cstr_info.th), + sizeof(opj_jp2_box_t)); + if (box == NULL) { + return 0; + } + for (i = 0; i < 2 ; i++) { + if (i) { + opj_stream_seek(cio, lenp, p_manager); + } + + lenp = opj_stream_tell(cio); + opj_stream_skip(cio, 4, p_manager); /* L [at the end] */ + opj_write_bytes(l_data_header, JPIP_THIX, 4); /* THIX */ + opj_stream_write_data(cio, l_data_header, 4, p_manager); + + opj_write_manf(i, cstr_info.tw * cstr_info.th, box, cio, p_manager); + + for (tileno = 0; tileno < cstr_info.tw * cstr_info.th; tileno++) { + box[tileno].length = (OPJ_UINT32)opj_write_tilemhix(coff, cstr_info, tileno, + cio, p_manager); + box[tileno].type = JPIP_MHIX; + } + + len = (OPJ_UINT32)(opj_stream_tell(cio) - lenp); + opj_stream_seek(cio, lenp, p_manager); + opj_write_bytes(l_data_header, len, 4); /* L */ + opj_stream_write_data(cio, l_data_header, 4, p_manager); + opj_stream_seek(cio, lenp + len, p_manager); + + } + + opj_free(box); + + return (int)len; +} + +/* + * Write tile-part headers mhix box + * + * @param[in] coff offset of j2k codestream + * @param[in] cstr_info codestream information + * @param[in] tileno tile number + * @param[in] cio file output handle + * @return length of mhix box + */ +int opj_write_tilemhix(int coff, opj_codestream_info_t cstr_info, int tileno, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager) +{ + OPJ_BYTE l_data_header [8]; + int i; + opj_tile_info_t tile; + opj_tp_info_t tp; + opj_marker_info_t *marker; + OPJ_UINT32 len; + OPJ_OFF_T lenp; + + lenp = opj_stream_tell(cio); + opj_stream_skip(cio, 4, + p_manager); /* L [at the end] */ + opj_write_bytes(l_data_header, JPIP_MHIX, + 4); /* MHIX */ + opj_stream_write_data(cio, l_data_header, 4, p_manager); + + tile = cstr_info.tile[tileno]; + tp = tile.tp[0]; + + opj_write_bytes(l_data_header, + (OPJ_UINT32)(tp.tp_end_header - tp.tp_start_pos + 1), + 8); /* TLEN */ + opj_stream_write_data(cio, l_data_header, 8, p_manager); + + marker = cstr_info.tile[tileno].marker; + + for (i = 0; i < cstr_info.tile[tileno].marknum; + i++) { /* Marker restricted to 1 apparition */ + opj_write_bytes(l_data_header, marker[i].type, 2); + opj_write_bytes(l_data_header + 2, 0, 2); + opj_stream_write_data(cio, l_data_header, 4, p_manager); + opj_write_bytes(l_data_header, (OPJ_UINT32)(marker[i].pos - coff), 8); + opj_stream_write_data(cio, l_data_header, 8, p_manager); + opj_write_bytes(l_data_header, (OPJ_UINT32)marker[i].len, 2); + opj_stream_write_data(cio, l_data_header, 2, p_manager); + } + + /* free( marker);*/ + + len = (OPJ_UINT32)(opj_stream_tell(cio) - lenp); + opj_stream_seek(cio, lenp, p_manager); + opj_write_bytes(l_data_header, len, 4); /* L */ + opj_stream_write_data(cio, l_data_header, 4, p_manager); + opj_stream_seek(cio, lenp + len, p_manager); + + return (int)len; +}
  6. Download patch openjpeg/src/lib/openjp2/thread.c
  7. Download patch openjpeg/src/lib/openjp2/opj_config.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_config.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_config.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,11 @@ +/* create opj_config.h for CMake */ +/*** SET BY GS CONFIGURE SCRIPT ****/ +/*#define OPJ_HAVE_STDINT_H 1 */ + +/*--------------------------------------------------------------------------*/ +/* OpenJPEG Versioning */ + +/* Version number. */ +#define OPJ_VERSION_MAJOR 2 +#define OPJ_VERSION_MINOR 2 +#define OPJ_VERSION_BUILD 0
  8. Download patch openjpeg/src/lib/openjp2/bio.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/bio.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/bio.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,134 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_BIO_H +#define OPJ_BIO_H + +#include <stddef.h> /* ptrdiff_t */ + +/** +@file bio.h +@brief Implementation of an individual bit input-output (BIO) + +The functions in BIO.C have for goal to realize an individual bit input - output. +*/ + +/** @defgroup BIO BIO - Individual bit input-output stream */ +/*@{*/ + +/** +Individual bit input-output stream (BIO) +*/ +typedef struct opj_bio { + /** pointer to the start of the buffer */ + OPJ_BYTE *start; + /** pointer to the end of the buffer */ + OPJ_BYTE *end; + /** pointer to the present position in the buffer */ + OPJ_BYTE *bp; + /** temporary place where each byte is read or written */ + OPJ_UINT32 buf; + /** coder : number of bits free to write. decoder : number of bits read */ + OPJ_UINT32 ct; +} opj_bio_t; + +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ +/** +Create a new BIO handle +@return Returns a new BIO handle if successful, returns NULL otherwise +*/ +opj_bio_t* opj_bio_create(void); +/** +Destroy a previously created BIO handle +@param bio BIO handle to destroy +*/ +void opj_bio_destroy(opj_bio_t *bio); +/** +Number of bytes written. +@param bio BIO handle +@return Returns the number of bytes written +*/ +ptrdiff_t opj_bio_numbytes(opj_bio_t *bio); +/** +Init encoder +@param bio BIO handle +@param bp Output buffer +@param len Output buffer length +*/ +void opj_bio_init_enc(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len); +/** +Init decoder +@param bio BIO handle +@param bp Input buffer +@param len Input buffer length +*/ +void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len); +/** +Write bits +@param bio BIO handle +@param v Value of bits +@param n Number of bits to write +*/ +void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n); +/** +Read bits +@param bio BIO handle +@param n Number of bits to read +@return Returns the corresponding read number +*/ +OPJ_UINT32 opj_bio_read(opj_bio_t *bio, OPJ_UINT32 n); +/** +Flush bits +@param bio BIO handle +@return Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise +*/ +OPJ_BOOL opj_bio_flush(opj_bio_t *bio); +/** +Passes the ending bits (coming from flushing) +@param bio BIO handle +@return Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise +*/ +OPJ_BOOL opj_bio_inalign(opj_bio_t *bio); +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_BIO_H */ +
  9. Download patch openjpeg/src/lib/openjp2/opj_config_private.h.cmake.in

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_config_private.h.cmake.in 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_config_private.h.cmake.in 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,49 @@ +/* create opj_config_private.h for CMake */ +#cmakedefine OPJ_HAVE_INTTYPES_H @OPJ_HAVE_INTTYPES_H@ + +#define OPJ_PACKAGE_VERSION "@PACKAGE_VERSION@" + +/* Not used by openjp2*/ +/*#cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@*/ +/*#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@*/ +/*#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@*/ +/*#cmakedefine HAVE_STRING_H @HAVE_STRING_H@*/ +/*#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@*/ +/*#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ */ +/*#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@*/ + +#cmakedefine _LARGEFILE_SOURCE +#cmakedefine _LARGE_FILES +#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ +#cmakedefine OPJ_HAVE_FSEEKO @OPJ_HAVE_FSEEKO@ + +/* find whether or not have <malloc.h> */ +#cmakedefine OPJ_HAVE_MALLOC_H +/* check if function `aligned_alloc` exists */ +#cmakedefine OPJ_HAVE_ALIGNED_ALLOC +/* check if function `_aligned_malloc` exists */ +#cmakedefine OPJ_HAVE__ALIGNED_MALLOC +/* check if function `memalign` exists */ +#cmakedefine OPJ_HAVE_MEMALIGN +/* check if function `posix_memalign` exists */ +#cmakedefine OPJ_HAVE_POSIX_MEMALIGN + +#if !defined(_POSIX_C_SOURCE) +#if defined(OPJ_HAVE_FSEEKO) || defined(OPJ_HAVE_POSIX_MEMALIGN) +/* Get declarations of fseeko, ftello, posix_memalign. */ +#define _POSIX_C_SOURCE 200112L +#endif +#endif + +/* Byte order. */ +/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or +__LITTLE_ENDIAN__ to match the endianness of the architecture being +compiled for. This is not necessarily the same as the architecture of the +machine doing the building. In order to support Universal Binaries on +Mac OS X, we prefer those defines to decide the endianness. +On other platforms we use the result of the TRY_RUN. */ +#if !defined(__APPLE__) +#cmakedefine OPJ_BIG_ENDIAN +#elif defined(__BIG_ENDIAN__) +# define OPJ_BIG_ENDIAN +#endif
  10. Download patch openjpeg/src/lib/openjp2/thread.h
  11. Download patch openjpeg/src/lib/openjp2/ppix_manager.c
  12. Download patch openjpeg/src/lib/openjp2/tpix_manager.c

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/tpix_manager.c 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/tpix_manager.c 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,190 @@ +/* + * $Id: tpix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $ + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2003-2004, Yannick Verschueren + * Copyright (c) 2010-2011, Kaori Hagihara + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*! \file + * \brief Modification of jpip.c from 2KAN indexer + */ + +#include "opj_includes.h" + +#define MAX(a,b) ((a)>(b)?(a):(b)) + +/* + * Get number of maximum tile parts per tile + * + * @param[in] cstr_info codestream information + * @return number of maximum tile parts per tile + */ +int get_num_max_tile_parts(opj_codestream_info_t cstr_info); + + +/* + * Write faix box of tpix + * + * @param[in] coff offset of j2k codestream + * @param[in] compno component number + * @param[in] cstr_info codestream information + * @param[in] j2klen length of j2k codestream + * @param[in] cio file output handle + * @return length of faix box + */ + +int opj_write_tpix(int coff, + opj_codestream_info_t cstr_info, + int j2klen, opj_stream_private_t *cio, + opj_event_mgr_t * p_manager) +{ + OPJ_BYTE l_data_header [4]; + OPJ_UINT32 len; + OPJ_OFF_T lenp; + + lenp = opj_stream_tell(cio); + opj_stream_skip(cio, 4, p_manager); + opj_write_bytes(l_data_header, JPIP_TPIX, 4); /* TPIX */ + opj_stream_write_data(cio, l_data_header, 4, p_manager); + + opj_write_tpixfaix(coff, 0, cstr_info, j2klen, cio, p_manager); + + len = (OPJ_UINT32)(opj_stream_tell(cio) - lenp); + + opj_stream_skip(cio, lenp, p_manager); + opj_write_bytes(l_data_header, len, 4); /* L */ + opj_stream_write_data(cio, l_data_header, 4, p_manager); + opj_stream_seek(cio, lenp + len, p_manager); + + return (int)len; +} + +int opj_write_tpixfaix(int coff, + int compno, + opj_codestream_info_t cstr_info, + int j2klen, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager) +{ + OPJ_UINT32 len; + OPJ_OFF_T lenp; + OPJ_UINT32 i, j; + OPJ_UINT32 Aux; + OPJ_UINT32 num_max_tile_parts; + OPJ_UINT32 size_of_coding; /* 4 or 8 */ + opj_tp_info_t tp; + OPJ_BYTE l_data_header [8]; + OPJ_UINT32 version; + + num_max_tile_parts = (OPJ_UINT32)get_num_max_tile_parts(cstr_info); + + if (j2klen > pow(2, 32)) { + size_of_coding = 8; + version = num_max_tile_parts == 1 ? 1 : 3; + } else { + size_of_coding = 4; + version = num_max_tile_parts == 1 ? 0 : 2; + } + + lenp = opj_stream_tell(cio); + opj_stream_skip(cio, 4, p_manager); /* L [at the end] */ + opj_write_bytes(l_data_header, JPIP_FAIX, 4); /* FAIX */ + opj_stream_write_data(cio, l_data_header, 4, p_manager); + opj_write_bytes(l_data_header, version, 1); /* Version 0 = 4 bytes */ + opj_stream_write_data(cio, l_data_header, 1, p_manager); + + opj_write_bytes(l_data_header, num_max_tile_parts, + size_of_coding); /* NMAX */ + opj_stream_write_data(cio, l_data_header, size_of_coding, p_manager); + opj_write_bytes(l_data_header, (OPJ_UINT32)(cstr_info.tw * cstr_info.th), + size_of_coding); /* M */ + opj_stream_write_data(cio, l_data_header, size_of_coding, p_manager); + + for (i = 0; i < (OPJ_UINT32)(cstr_info.tw * cstr_info.th); i++) { + for (j = 0; j < (OPJ_UINT32)cstr_info.tile[i].num_tps; j++) { + tp = cstr_info.tile[i].tp[j]; + + opj_write_bytes(l_data_header, (OPJ_UINT32)(tp.tp_start_pos - coff), + size_of_coding); /* start position */ + opj_stream_write_data(cio, l_data_header, size_of_coding, p_manager); + opj_write_bytes(l_data_header, + (OPJ_UINT32)(tp.tp_end_pos - tp.tp_start_pos + 1), + size_of_coding); /* length */ + opj_stream_write_data(cio, l_data_header, size_of_coding, p_manager); + + if (version & 0x02) { + if (cstr_info.tile[i].num_tps == 1 && cstr_info.numdecompos[compno] > 1) { + Aux = (OPJ_UINT32)(cstr_info.numdecompos[compno] + 1); + } else { + Aux = j + 1; + } + + opj_write_bytes(l_data_header, Aux, 4); + opj_stream_write_data(cio, l_data_header, 4, p_manager); + + /*cio_write(img.tile[i].tile_parts[j].num_reso_AUX,4);*/ /* Aux_i,j : Auxiliary value */ + /* fprintf(stderr,"AUX value %d\n",Aux);*/ + } + /*cio_write(0,4);*/ + } + /* PADDING */ + while (j < num_max_tile_parts) { + + opj_write_bytes(l_data_header, 0, + size_of_coding); /* start position */ + opj_stream_write_data(cio, l_data_header, size_of_coding, p_manager); + opj_write_bytes(l_data_header, 0, + size_of_coding); /* length */ + opj_stream_write_data(cio, l_data_header, size_of_coding, p_manager); + + if (version & 0x02) { + opj_write_bytes(l_data_header, 0, 4); /* Aux_i,j : Auxiliary value */ + } + opj_stream_write_data(cio, l_data_header, 4, p_manager); + j++; + } + } + + len = (OPJ_UINT32)(opj_stream_tell(cio) - lenp); + opj_stream_seek(cio, lenp, p_manager); + opj_write_bytes(l_data_header, len, 4); /* L */ + opj_stream_write_data(cio, l_data_header, 4, p_manager); + opj_stream_seek(cio, lenp + len, p_manager); + + return (int)len; +} + +int get_num_max_tile_parts(opj_codestream_info_t cstr_info) +{ + int num_max_tp = 0, i; + + for (i = 0; i < cstr_info.tw * cstr_info.th; i++) { + num_max_tp = MAX(cstr_info.tile[i].num_tps, num_max_tp); + } + + return num_max_tp; +}
  13. Download patch openjpeg/src/lib/openjp2/opj_intmath.h
  14. Download patch openjpeg/src/lib/openjp2/t1_generate_luts.c
  15. Download patch openjpeg/src/lib/openjp2/jp2.c
  16. Download patch debian/patches/0002-pdfwrite-Guard-against-trying-to-output-an-infinite-.patch

    --- 9.22~dfsg-2.1/debian/patches/0002-pdfwrite-Guard-against-trying-to-output-an-infinite-.patch 2018-04-20 10:28:29.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/debian/patches/0002-pdfwrite-Guard-against-trying-to-output-an-infinite-.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -From: Ken Sharp <ken.sharp@artifex.com> -Date: Wed, 18 Apr 2018 15:46:32 +0100 -Subject: pdfwrite - Guard against trying to output an infinite number -Origin: http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=39b1e54b2968620723bf32e96764c88797714879 -Bug-Debian: https://bugs.debian.org/896069 -Bug: https://bugs.ghostscript.com/show_bug.cgi?id=699255 -Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2018-10194 - -Bug #699255 " Buffer overflow on pprintg1 due to mishandle postscript file data to pdf" - -The file uses an enormous parameter to xyxhow, causing an overflow in -the calculation of text positioning (value > 1e39). - -Since this is basically a nonsense value, and PostScript only supports -real values up to 1e38, this patch follows the same approach as for -a degenerate CTM, and treats it as 0. - -Adobe Acrobat Distiller throws a limitcheck error, so we could do that -instead if this approach proves to be a problem. ---- - devices/vector/gdevpdts.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/devices/vector/gdevpdts.c b/devices/vector/gdevpdts.c -index 848ad781f..172fe6bc3 100644 ---- a/devices/vector/gdevpdts.c -+++ b/devices/vector/gdevpdts.c -@@ -103,9 +103,14 @@ append_text_move(pdf_text_state_t *pts, double dw) - static int - set_text_distance(gs_point *pdist, double dx, double dy, const gs_matrix *pmat) - { -- int code = gs_distance_transform_inverse(dx, dy, pmat, pdist); -+ int code; - double rounded; - -+ if (dx > 1e38 || dy > 1e38) -+ code = gs_error_undefinedresult; -+ else -+ code = gs_distance_transform_inverse(dx, dy, pmat, pdist); -+ - if (code == gs_error_undefinedresult) { - /* The CTM is degenerate. - Can't know the distance in user space. --- -2.17.0 -
  17. Download patch openjpeg/src/lib/openjp2/t1.c
  18. Download patch openjpeg/src/lib/openjp2/opj_codec.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_codec.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_codec.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,166 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_CODEC_H +#define OPJ_CODEC_H +/** +@file opj_codec.h +*/ + + +/** + * Main codec handler used for compression or decompression. + */ +typedef struct opj_codec_private { + /** FIXME DOC */ + union { + /** + * Decompression handler. + */ + struct opj_decompression { + /** Main header reading function handler */ + OPJ_BOOL(*opj_read_header)(struct opj_stream_private * cio, + void * p_codec, + opj_image_t **p_image, + struct opj_event_mgr * p_manager); + + /** Decoding function */ + OPJ_BOOL(*opj_decode)(void * p_codec, + struct opj_stream_private * p_cio, + opj_image_t * p_image, + struct opj_event_mgr * p_manager); + + /** FIXME DOC */ + OPJ_BOOL(*opj_read_tile_header)(void * p_codec, + OPJ_UINT32 * p_tile_index, + OPJ_UINT32 * p_data_size, + OPJ_INT32 * p_tile_x0, + OPJ_INT32 * p_tile_y0, + OPJ_INT32 * p_tile_x1, + OPJ_INT32 * p_tile_y1, + OPJ_UINT32 * p_nb_comps, + OPJ_BOOL * p_should_go_on, + struct opj_stream_private * p_cio, + struct opj_event_mgr * p_manager); + + /** FIXME DOC */ + OPJ_BOOL(*opj_decode_tile_data)(void * p_codec, + OPJ_UINT32 p_tile_index, + OPJ_BYTE * p_data, + OPJ_UINT32 p_data_size, + struct opj_stream_private * p_cio, + struct opj_event_mgr * p_manager); + + /** Reading function used after codestream if necessary */ + OPJ_BOOL(* opj_end_decompress)(void *p_codec, + struct opj_stream_private * cio, + struct opj_event_mgr * p_manager); + + /** Codec destroy function handler */ + void (*opj_destroy)(void * p_codec); + + /** Setup decoder function handler */ + void (*opj_setup_decoder)(void * p_codec, opj_dparameters_t * p_param); + + /** Set decode area function handler */ + OPJ_BOOL(*opj_set_decode_area)(void * p_codec, + opj_image_t * p_image, + OPJ_INT32 p_start_x, + OPJ_INT32 p_end_x, + OPJ_INT32 p_start_y, + OPJ_INT32 p_end_y, + struct opj_event_mgr * p_manager); + + /** Get tile function */ + OPJ_BOOL(*opj_get_decoded_tile)(void *p_codec, + opj_stream_private_t * p_cio, + opj_image_t *p_image, + struct opj_event_mgr * p_manager, + OPJ_UINT32 tile_index); + + /** Set the decoded resolution factor */ + OPJ_BOOL(*opj_set_decoded_resolution_factor)(void * p_codec, + OPJ_UINT32 res_factor, + opj_event_mgr_t * p_manager); + + } m_decompression; + + /** + * Compression handler. FIXME DOC + */ + struct opj_compression { + OPJ_BOOL(* opj_start_compress)(void *p_codec, + struct opj_stream_private * cio, + struct opj_image * p_image, + struct opj_event_mgr * p_manager); + + OPJ_BOOL(* opj_encode)(void * p_codec, + struct opj_stream_private *p_cio, + struct opj_event_mgr * p_manager); + + OPJ_BOOL(* opj_write_tile)(void * p_codec, + OPJ_UINT32 p_tile_index, + OPJ_BYTE * p_data, + OPJ_UINT32 p_data_size, + struct opj_stream_private * p_cio, + struct opj_event_mgr * p_manager); + + OPJ_BOOL(* opj_end_compress)(void * p_codec, + struct opj_stream_private * p_cio, + struct opj_event_mgr * p_manager); + + void (* opj_destroy)(void * p_codec); + + OPJ_BOOL(* opj_setup_encoder)(void * p_codec, + opj_cparameters_t * p_param, + struct opj_image * p_image, + struct opj_event_mgr * p_manager); + } m_compression; + } m_codec_data; + /** FIXME DOC*/ + void * m_codec; + /** Event handler */ + opj_event_mgr_t m_event_mgr; + /** Flag to indicate if the codec is used to decode or encode*/ + OPJ_BOOL is_decompressor; + void (*opj_dump_codec)(void * p_codec, OPJ_INT32 info_flag, + FILE* output_stream); + opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec); + opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec); + + /** Set number of threads */ + OPJ_BOOL(*opj_set_threads)(void * p_codec, OPJ_UINT32 num_threads); +} +opj_codec_private_t; + + +#endif /* OPJ_CODEC_H */ +
  19. Download patch debian/rules

    --- 9.22~dfsg-2.1/debian/rules 2018-04-20 10:28:29.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/debian/rules 2018-02-23 20:12:00.000000000 +0000 @@ -96,9 +96,15 @@ gs_opts += WHICH_CMS=lcms2 SHARE_LCMS=1 dev-deps += lcms2 # openjpeg requires patching for ICC and CMYK support -gs_opts += SHARE_JPX=1 +#gs_opts += SHARE_JPX=1 #DEB_CONFIGURE_EXTRA_FLAGS += --disable-openjpeg -dev-deps += openjp2-7 +#dev-deps += openjp2-7 + +# In contrary to Debian we use the openjpeg convenience library, as the Ubuntu +# security team does not accept the upstream openjpeg library into Ubuntu +# Main (https://bugs.launchpad.net/bugs/711061) +gs_opts += SHARE_JPX=0 +DEB_CONFIGURE_EXTRA_FLAGS += --enable-openjpeg --without-jasper fontdirs = /var/lib/ghostscript/fonts /usr/share/cups/fonts \ /usr/share/ghostscript/fonts /usr/local/lib/ghostscript/fonts \
  20. Download patch openjpeg/src/lib/openjp2/invert.c
  21. Download patch openjpeg/src/lib/openjp2/opj_common.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_common.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_common.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2017, IntoPIX SA <support@intopix.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_COMMMON_H +#define OPJ_COMMMON_H + +/* + ========================================================== + Common constants shared among several modules + ========================================================== +*/ +#define OPJ_COMMON_CBLK_DATA_EXTRA 2 /**< Margin for a fake FFFF marker */ + +#endif /* OPJ_COMMMON_H */
  22. Download patch openjpeg/NEWS.md

    --- 9.22~dfsg-2.1/openjpeg/NEWS.md 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/NEWS.md 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,94 @@ +# OpenJPEG NEWS + +More details in the [Changelog](https://github.com/uclouvain/openjpeg/blob/master/CHANGELOG.md) + +## OpenJPEG 2.2.0 + +No API/ABI break compared to v2.1.2 but additional symbols for multithreading support (hence the MINOR version bump). + +### Codebase improvements + +* Memory consumption reduction at decoding side [\#968](https://github.com/uclouvain/openjpeg/pull/968) +* Multi-threading support at decoding side [\#786](https://github.com/uclouvain/openjpeg/pull/786) +* Tier-1 speed optimizations (encoder and decoder) [\#945](https://github.com/uclouvain/openjpeg/pull/945) +* Tier-1 decoder further optimization [\#783](https://github.com/uclouvain/openjpeg/pull/783) +* Inverse 5x3 DWT speed optimization: single-pass lifting and SSE2/AVX2 implementation [\#957](https://github.com/uclouvain/openjpeg/pull/957) +* Fixed a bug that prevented OpenJPEG to compress losslessly in some situations [\#949](https://github.com/uclouvain/openjpeg/pull/949) +* Fixed BYPASS/LAZY, RESTART/TERMALL and PTERM mode switches +* Many other bug fixes (including security fixes) + +### Maintenance improvements + +* Benchmarking scripts to automatically compare the speed of latest OpenJPEG build with latest release and/or Kakadu binaries [\#917](https://github.com/uclouvain/openjpeg/pull/917) +* CPU and RAM usage profiling scripts [\#918](https://github.com/uclouvain/openjpeg/pull/918) +* Codebase reformatting (with astyle) and scripts to automatically check that new commits comply with formatting guidelines [\#919](https://github.com/uclouvain/openjpeg/pull/919) +* Register OpenJPEG at Google OSS Fuzz initiative, so as to automatically have OpenJPEG tested against Google fuzzer [\#965](https://github.com/uclouvain/openjpeg/issues/965) + +## OpenJPEG 2.1.2 + +* Bug fixes (including security fixes) +* No API/ABI break compared to v2.1.1 + +## OpenJPEG 2.1.1 + +* Huge amount of critical bugfixes +* Speed improvements +* No API/ABI break compared to v2.1 + +## OpenJPEG 2.1.0 + +### New Features + + * Digital Cinema profiles have been fixed and updated + * New option to disable MCT if needed + * extended RAW support: it is now possible to input raw images + with subsampled color components (422, 420, etc) + * New way to deal with profiles + +### API/ABI modifications +(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details) + + * Removed deprecated functions + * opj_stream_create_default_file_stream(FILE*,...) + * opj_stream_create_file_stream(FILE*,...) + * opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data) + * Added + * opj_stream_create_default_file_stream(char*,...) + * opj_stream_create_file_stream(char*,...) + * opj_stream_destroy(opj_stream_t*) + * opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data, + ... opj_stream_free_user_data_fn p_function) + * JPEG 2000 profiles and Part-2 extensions defined through '#define' + * Changed + * 'alpha' field added to 'opj_image_comp' structure + * 'OPJ_CLRSPC_EYCC' added to enum COLOR_SPACE + * 'OPJ_CLRSPC_CMYK' added to enum COLOR_SPACE + * 'OPJ_CODEC_JPP' and 'OPJ_CODEC_JPX' added to CODEC_FORMAT + (not yet used in use) + * 'max_cs_size' and 'rsiz' fields added to opj_cparameters_t + +### Misc + + * OpenJPEG is now officially conformant with JPEG 2000 Part-1 + and will soon become official reference software at the + JPEG committee. + * Huge amount of bug fixes. See CHANGES for details. + + +## OpenJPEG 2.0.0 + +### New Features + + * streaming capabilities + * merge JP3D + +### API modifications +(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details) + + * Use a 64bits capable API + +### Misc + + * removed autotools build system + * folders hierarchies reorganisation + * Huge amount of bug fixes. See CHANGES for details.
  23. Download patch openjpeg/src/lib/openjp2/opj_includes.h
  24. Download patch openjpeg/src/lib/openjp2/jp2.h
  25. Download patch openjpeg/src/lib/openjp2/bench_dwt.c
  26. Download patch openjpeg/src/lib/openjp2/t1.h
  27. Download patch openjpeg/src/lib/openjp2/opj_clock.c

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_clock.c 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_clock.c 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "opj_includes.h" + +#ifdef _WIN32 +#include <windows.h> +#else +#include <sys/time.h> +#include <sys/resource.h> +#include <sys/times.h> +#endif /* _WIN32 */ + +OPJ_FLOAT64 opj_clock(void) +{ +#ifdef _WIN32 + /* _WIN32: use QueryPerformance (very accurate) */ + LARGE_INTEGER freq, t ; + /* freq is the clock speed of the CPU */ + QueryPerformanceFrequency(&freq) ; + /* cout << "freq = " << ((double) freq.QuadPart) << endl; */ + /* t is the high resolution performance counter (see MSDN) */ + QueryPerformanceCounter(& t) ; + return ((OPJ_FLOAT64) t.QuadPart / (OPJ_FLOAT64) freq.QuadPart) ; +#else + /* Unix or Linux: use resource usage */ + struct rusage t; + OPJ_FLOAT64 procTime; + /* (1) Get the rusage data structure at this moment (man getrusage) */ + getrusage(0, &t); + /* (2) What is the elapsed time ? - CPU time = User time + System time */ + /* (2a) Get the seconds */ + procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec); + /* (2b) More precisely! Get the microseconds part ! */ + return (procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * + 1e-6) ; +#endif +} +
  28. Download patch openjpeg/src/lib/openjp2/t2.c
  29. Download patch openjpeg/src/lib/openjp2/opj_malloc.c
  30. Download patch openjpeg/src/lib/openjp2/tls_keys.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/tls_keys.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/tls_keys.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,37 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2016, Even Rouault + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_TLS_KEYS_H +#define OPJ_TLS_KEYS_H + +#define OPJ_TLS_KEY_T1 0 + +#endif /* OPJ_TLS_KEY_H */
  31. Download patch openjpeg/src/lib/openjp2/invert.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/invert.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/invert.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,64 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_INVERT_H +#define OPJ_INVERT_H +/** +@file invert.h +@brief Implementation of the matrix inversion + +The function in INVERT.H compute a matrix inversion with a LUP method +*/ + +/** @defgroup INVERT INVERT - Implementation of a matrix inversion */ +/*@{*/ +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ + +/** + * Calculates a n x n double matrix inversion with a LUP method. Data is aligned, rows after rows (or columns after columns). + * The function does not take ownership of any memory block, data must be fred by the user. + * + * @param pSrcMatrix the matrix to invert. + * @param pDestMatrix data to store the inverted matrix. + * @param nb_compo size of the matrix + * @return OPJ_TRUE if the inversion is successful, OPJ_FALSE if the matrix is singular. + */ +OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix, + OPJ_FLOAT32 * pDestMatrix, + OPJ_UINT32 nb_compo); +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_INVERT_H */
  32. Download patch debian/control

    --- 9.22~dfsg-2.1/debian/control 2018-04-20 10:28:29.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/debian/control 2018-04-24 17:34:45.000000000 +0000 @@ -1,7 +1,8 @@ Source: ghostscript Section: text Priority: optional -Maintainer: Debian Printing Team <debian-printing@lists.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Debian Printing Team <debian-printing@lists.debian.org> Build-Depends: cdbs, autoconf, debhelper, @@ -21,7 +22,6 @@ Build-Depends: cdbs, libice-dev, libsm-dev, liblcms2-dev, - libopenjp2-7-dev, libfreetype6-dev, libfontconfig1-dev, libcups2-dev,
  33. Download patch openjpeg/src/lib/openjp2/opj_config.h.cmake.in

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_config.h.cmake.in 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_config.h.cmake.in 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,10 @@ +/* create opj_config.h for CMake */ +#cmakedefine OPJ_HAVE_STDINT_H @OPJ_HAVE_STDINT_H@ + +/*--------------------------------------------------------------------------*/ +/* OpenJPEG Versioning */ + +/* Version number. */ +#define OPJ_VERSION_MAJOR @OPENJPEG_VERSION_MAJOR@ +#define OPJ_VERSION_MINOR @OPENJPEG_VERSION_MINOR@ +#define OPJ_VERSION_BUILD @OPENJPEG_VERSION_BUILD@
  34. Download patch openjpeg/src/lib/openjp2/CMakeLists.txt
  35. Download patch openjpeg/src/lib/openjp2/phix_manager.c
  36. Download patch openjpeg/src/lib/openjp2/opj_clock.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_clock.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_clock.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,59 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_CLOCK_H +#define OPJ_CLOCK_H +/** +@file opj_clock.h +@brief Internal function for timing + +The functions in OPJ_CLOCK.C are internal utilities mainly used for timing. +*/ + +/** @defgroup MISC MISC - Miscellaneous internal functions */ +/*@{*/ + +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ + +/** +Difference in successive opj_clock() calls tells you the elapsed time +@return Returns time in seconds +*/ +OPJ_FLOAT64 opj_clock(void); + +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_CLOCK_H */ +
  37. Download patch openjpeg/src/lib/openjp2/t2.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/t2.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/t2.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,135 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR + * Copyright (c) 2012, CS Systemes d'Information, France + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_T2_H +#define OPJ_T2_H +/** +@file t2.h +@brief Implementation of a tier-2 coding (packetization of code-block data) (T2) + +*/ + +/** @defgroup T2 T2 - Implementation of a tier-2 coding */ +/*@{*/ + +/** +Tier-2 coding +*/ +typedef struct opj_t2 { + + /** Encoding: pointer to the src image. Decoding: pointer to the dst image. */ + opj_image_t *image; + /** pointer to the image coding parameters */ + opj_cp_t *cp; +} opj_t2_t; + +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ + +/** +Encode the packets of a tile to a destination buffer +@param t2 T2 handle +@param tileno number of the tile encoded +@param tile the tile for which to write the packets +@param maxlayers maximum number of layers +@param dest the destination buffer +@param p_data_written FIXME DOC +@param len the length of the destination buffer +@param cstr_info Codestream information structure +@param tpnum Tile part number of the current tile +@param tppos The position of the tile part flag in the progression order +@param pino FIXME DOC +@param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass +*/ +OPJ_BOOL opj_t2_encode_packets(opj_t2_t* t2, + OPJ_UINT32 tileno, + opj_tcd_tile_t *tile, + OPJ_UINT32 maxlayers, + OPJ_BYTE *dest, + OPJ_UINT32 * p_data_written, + OPJ_UINT32 len, + opj_codestream_info_t *cstr_info, + OPJ_UINT32 tpnum, + OPJ_INT32 tppos, + OPJ_UINT32 pino, + J2K_T2_MODE t2_mode); + +/** +Decode the packets of a tile from a source buffer +@param t2 T2 handle +@param tileno number that identifies the tile for which to decode the packets +@param tile tile for which to decode the packets +@param src FIXME DOC +@param p_data_read the source buffer +@param len length of the source buffer +@param cstr_info FIXME DOC +@param p_manager the user event manager + +@return FIXME DOC + */ +OPJ_BOOL opj_t2_decode_packets(opj_t2_t *t2, + OPJ_UINT32 tileno, + opj_tcd_tile_t *tile, + OPJ_BYTE *src, + OPJ_UINT32 * p_data_read, + OPJ_UINT32 len, + opj_codestream_index_t *cstr_info, + opj_event_mgr_t *p_manager); + +/** + * Creates a Tier 2 handle + * + * @param p_image Source or destination image + * @param p_cp Image coding parameters. + * @return a new T2 handle if successful, NULL otherwise. +*/ +opj_t2_t* opj_t2_create(opj_image_t *p_image, opj_cp_t *p_cp); + +/** +Destroy a T2 handle +@param t2 T2 handle to destroy +*/ +void opj_t2_destroy(opj_t2_t *t2); + +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_T2_H */
  38. Download patch openjpeg/src/lib/openjp2/opj_malloc.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_malloc.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_malloc.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,106 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2007, Callum Lerwick <seg@haxxed.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_MALLOC_H +#define OPJ_MALLOC_H + +#include <stddef.h> +/** +@file opj_malloc.h +@brief Internal functions + +The functions in opj_malloc.h are internal utilities used for memory management. +*/ + +/** @defgroup MISC MISC - Miscellaneous internal functions */ +/*@{*/ + +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ + +/** +Allocate an uninitialized memory block +@param size Bytes to allocate +@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available +*/ +void * opj_malloc(size_t size); + +/** +Allocate a memory block with elements initialized to 0 +@param numOfElements Blocks to allocate +@param sizeOfElements Bytes per block to allocate +@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available +*/ +void * opj_calloc(size_t numOfElements, size_t sizeOfElements); + +/** +Allocate memory aligned to a 16 byte boundary +@param size Bytes to allocate +@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available +*/ +void * opj_aligned_malloc(size_t size); +void * opj_aligned_realloc(void *ptr, size_t size); +void opj_aligned_free(void* ptr); + +/** +Allocate memory aligned to a 32 byte boundary +@param size Bytes to allocate +@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available +*/ +void * opj_aligned_32_malloc(size_t size); +void * opj_aligned_32_realloc(void *ptr, size_t size); + +/** +Reallocate memory blocks. +@param m Pointer to previously allocated memory block +@param s New size in bytes +@return Returns a void pointer to the reallocated (and possibly moved) memory block +*/ +void * opj_realloc(void * m, size_t s); + +/** +Deallocates or frees a memory block. +@param m Previously allocated memory block to be freed +*/ +void opj_free(void * m); + +#if defined(__GNUC__) && !defined(OPJ_SKIP_POISON) +#pragma GCC poison malloc calloc realloc free +#endif + +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_MALLOC_H */ +
  39. Download patch openjpeg/src/lib/openjp2/tgt.c
  40. Download patch openjpeg/LICENSE

    --- 9.22~dfsg-2.1/openjpeg/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/LICENSE 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2003-2009, Francois-Olivier Devaux + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France + * Copyright (c) 2012, CS Systemes d'Information, France + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */
  41. Download patch openjpeg/src/lib/openjp2/mct.c
  42. Download patch openjpeg/src/lib/openjp2/indexbox_manager.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/indexbox_manager.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/indexbox_manager.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,157 @@ +/* + * $Id: indexbox_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $ + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2003-2004, Yannick Verschueren + * Copyright (c) 2010-2011, Kaori Hagihara + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*! \file + * \brief Modification of jpip.c from 2KAN indexer + */ + +#ifndef INDEXBOX_MANAGER_H_ +# define INDEXBOX_MANAGER_H_ + +#include "openjpeg.h" +#include "j2k.h" /* needed to use jp2.h */ +#include "jp2.h" + +#define JPIP_CIDX 0x63696478 /* Codestream index */ +#define JPIP_CPTR 0x63707472 /* Codestream Finder Box */ +#define JPIP_MANF 0x6d616e66 /* Manifest Box */ +#define JPIP_FAIX 0x66616978 /* Fragment array Index box */ +#define JPIP_MHIX 0x6d686978 /* Main Header Index Table */ +#define JPIP_TPIX 0x74706978 /* Tile-part Index Table box */ +#define JPIP_THIX 0x74686978 /* Tile header Index Table box */ +#define JPIP_PPIX 0x70706978 /* Precinct Packet Index Table box */ +#define JPIP_PHIX 0x70686978 /* Packet Header index Table */ +#define JPIP_FIDX 0x66696478 /* File Index */ +#define JPIP_FPTR 0x66707472 /* File Finder */ +#define JPIP_PRXY 0x70727879 /* Proxy boxes */ +#define JPIP_IPTR 0x69707472 /* Index finder box */ +#define JPIP_PHLD 0x70686c64 /* Place holder */ + + +/* + * Write tile-part Index table box (superbox) + * + * @param[in] coff offset of j2k codestream + * @param[in] cstr_info codestream information + * @param[in] j2klen length of j2k codestream + * @param[in] cio file output handle + * @return length of tpix box + */ +int opj_write_tpix(int coff, opj_codestream_info_t cstr_info, int j2klen, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + + +/* + * Write tile header index table box (superbox) + * + * @param[in] coff offset of j2k codestream + * @param[in] cstr_info codestream information pointer + * @param[in] cio file output handle + * @return length of thix box + */ +int opj_write_thix(int coff, opj_codestream_info_t cstr_info, + opj_stream_private_t *cio, opj_event_mgr_t * p_manager); + + +/* + * Write precinct packet index table box (superbox) + * + * @param[in] coff offset of j2k codestream + * @param[in] cstr_info codestream information + * @param[in] EPHused true if EPH option used + * @param[in] j2klen length of j2k codestream + * @param[in] cio file output handle + * @return length of ppix box + */ +int opj_write_ppix(int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, + int j2klen, opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + + +/* + * Write packet header index table box (superbox) + * + * @param[in] coff offset of j2k codestream + * @param[in] cstr_info codestream information + * @param[in] EPHused true if EPH option used + * @param[in] j2klen length of j2k codestream + * @param[in] cio file output handle + * @return length of ppix box + */ +int opj_write_phix(int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, + int j2klen, opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + +/* + * Write manifest box (box) + * + * @param[in] second number to be visited + * @param[in] v number of boxes + * @param[in] box box to be manifested + * @param[in] cio file output handle + */ + +void opj_write_manf(int second, + int v, + opj_jp2_box_t *box, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + +/* + * Write main header index table (box) + * + * @param[in] coff offset of j2k codestream + * @param[in] cstr_info codestream information + * @param[in] cio file output handle + * @return length of mainmhix box + */ +int opj_write_mainmhix(int coff, opj_codestream_info_t cstr_info, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + +int opj_write_phixfaix(int coff, int compno, opj_codestream_info_t cstr_info, + OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + +int opj_write_ppixfaix(int coff, int compno, opj_codestream_info_t cstr_info, + OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + +int opj_write_tilemhix(int coff, opj_codestream_info_t cstr_info, int tileno, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + +int opj_write_tpixfaix(int coff, int compno, opj_codestream_info_t cstr_info, + int j2klen, opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + +#endif /* !INDEXBOX_MANAGER_H_ */
  43. Download patch openjpeg/src/lib/openjp2/tgt.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/tgt.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/tgt.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,148 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr> + * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France + * Copyright (c) 2012, CS Systemes d'Information, France + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_TGT_H +#define OPJ_TGT_H +/** +@file tgt.h +@brief Implementation of a tag-tree coder (TGT) + +The functions in TGT.C have for goal to realize a tag-tree coder. The functions in TGT.C +are used by some function in T2.C. +*/ + +/** @defgroup TGT TGT - Implementation of a tag-tree coder */ +/*@{*/ + +/** +Tag node +*/ +typedef struct opj_tgt_node { + struct opj_tgt_node *parent; + OPJ_INT32 value; + OPJ_INT32 low; + OPJ_UINT32 known; +} opj_tgt_node_t; + +/** +Tag tree +*/ +typedef struct opj_tgt_tree { + OPJ_UINT32 numleafsh; + OPJ_UINT32 numleafsv; + OPJ_UINT32 numnodes; + opj_tgt_node_t *nodes; + OPJ_UINT32 nodes_size; /* maximum size taken by nodes */ +} opj_tgt_tree_t; + + +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ +/** +Create a tag-tree +@param numleafsh Width of the array of leafs of the tree +@param numleafsv Height of the array of leafs of the tree +@param p_manager the event manager +@return Returns a new tag-tree if successful, returns NULL otherwise +*/ +opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv, + opj_event_mgr_t *p_manager); + +/** + * Reinitialises a tag-tree from an exixting one. + * + * @param p_tree the tree to reinitialize. + * @param p_num_leafs_h the width of the array of leafs of the tree + * @param p_num_leafs_v the height of the array of leafs of the tree + * @param p_manager the event manager + * @return a new tag-tree if successful, NULL otherwise +*/ +opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree, + OPJ_UINT32 p_num_leafs_h, + OPJ_UINT32 p_num_leafs_v, opj_event_mgr_t *p_manager); +/** +Destroy a tag-tree, liberating memory +@param tree Tag-tree to destroy +*/ +void opj_tgt_destroy(opj_tgt_tree_t *tree); +/** +Reset a tag-tree (set all leaves to 0) +@param tree Tag-tree to reset +*/ +void opj_tgt_reset(opj_tgt_tree_t *tree); +/** +Set the value of a leaf of a tag-tree +@param tree Tag-tree to modify +@param leafno Number that identifies the leaf to modify +@param value New value of the leaf +*/ +void opj_tgt_setvalue(opj_tgt_tree_t *tree, + OPJ_UINT32 leafno, + OPJ_INT32 value); +/** +Encode the value of a leaf of the tag-tree up to a given threshold +@param bio Pointer to a BIO handle +@param tree Tag-tree to modify +@param leafno Number that identifies the leaf to encode +@param threshold Threshold to use when encoding value of the leaf +*/ +void opj_tgt_encode(opj_bio_t *bio, + opj_tgt_tree_t *tree, + OPJ_UINT32 leafno, + OPJ_INT32 threshold); +/** +Decode the value of a leaf of the tag-tree up to a given threshold +@param bio Pointer to a BIO handle +@param tree Tag-tree to decode +@param leafno Number that identifies the leaf to decode +@param threshold Threshold to use when decoding value of the leaf +@return Returns 1 if the node's value < threshold, returns 0 otherwise +*/ +OPJ_UINT32 opj_tgt_decode(opj_bio_t *bio, + opj_tgt_tree_t *tree, + OPJ_UINT32 leafno, + OPJ_INT32 threshold); +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_TGT_H */
  44. Download patch openjpeg/src/lib/openjp2/mqc.c
  45. Download patch openjpeg/src/lib/openjp2/j2k.c
  46. Download patch openjpeg/src/lib/openjp2/mct.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/mct.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/mct.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,159 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR + * Copyright (c) 2012, CS Systemes d'Information, France + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_MCT_H +#define OPJ_MCT_H +/** +@file mct.h +@brief Implementation of a multi-component transforms (MCT) + +The functions in MCT.C have for goal to realize reversible and irreversible multicomponent +transform. The functions in MCT.C are used by some function in TCD.C. +*/ + +/** @defgroup MCT MCT - Implementation of a multi-component transform */ +/*@{*/ + +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ +/** +Apply a reversible multi-component transform to an image +@param c0 Samples for red component +@param c1 Samples for green component +@param c2 Samples blue component +@param n Number of samples for each component +*/ +void opj_mct_encode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, + OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n); +/** +Apply a reversible multi-component inverse transform to an image +@param c0 Samples for luminance component +@param c1 Samples for red chrominance component +@param c2 Samples for blue chrominance component +@param n Number of samples for each component +*/ +void opj_mct_decode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, + OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n); +/** +Get norm of the basis function used for the reversible multi-component transform +@param compno Number of the component (0->Y, 1->U, 2->V) +@return +*/ +OPJ_FLOAT64 opj_mct_getnorm(OPJ_UINT32 compno); + +/** +Apply an irreversible multi-component transform to an image +@param c0 Samples for red component +@param c1 Samples for green component +@param c2 Samples blue component +@param n Number of samples for each component +*/ +void opj_mct_encode_real(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, + OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n); +/** +Apply an irreversible multi-component inverse transform to an image +@param c0 Samples for luminance component +@param c1 Samples for red chrominance component +@param c2 Samples for blue chrominance component +@param n Number of samples for each component +*/ +void opj_mct_decode_real(OPJ_FLOAT32* OPJ_RESTRICT c0, + OPJ_FLOAT32* OPJ_RESTRICT c1, OPJ_FLOAT32* OPJ_RESTRICT c2, OPJ_UINT32 n); +/** +Get norm of the basis function used for the irreversible multi-component transform +@param compno Number of the component (0->Y, 1->U, 2->V) +@return +*/ +OPJ_FLOAT64 opj_mct_getnorm_real(OPJ_UINT32 compno); + +/** +FIXME DOC +@param p_coding_data MCT data +@param n size of components +@param p_data components +@param p_nb_comp nb of components (i.e. size of p_data) +@param is_signed tells if the data is signed +@return OPJ_FALSE if function encounter a problem, OPJ_TRUE otherwise +*/ +OPJ_BOOL opj_mct_encode_custom( + OPJ_BYTE * p_coding_data, + OPJ_UINT32 n, + OPJ_BYTE ** p_data, + OPJ_UINT32 p_nb_comp, + OPJ_UINT32 is_signed); +/** +FIXME DOC +@param pDecodingData MCT data +@param n size of components +@param pData components +@param pNbComp nb of components (i.e. size of p_data) +@param isSigned tells if the data is signed +@return OPJ_FALSE if function encounter a problem, OPJ_TRUE otherwise +*/ +OPJ_BOOL opj_mct_decode_custom( + OPJ_BYTE * pDecodingData, + OPJ_UINT32 n, + OPJ_BYTE ** pData, + OPJ_UINT32 pNbComp, + OPJ_UINT32 isSigned); +/** +FIXME DOC +@param pNorms MCT data +@param p_nb_comps size of components +@param pMatrix components +@return +*/ +void opj_calculate_norms(OPJ_FLOAT64 * pNorms, + OPJ_UINT32 p_nb_comps, + OPJ_FLOAT32 * pMatrix); +/** +FIXME DOC +*/ +const OPJ_FLOAT64 * opj_mct_get_mct_norms(void); +/** +FIXME DOC +*/ +const OPJ_FLOAT64 * opj_mct_get_mct_norms_real(void); +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_MCT_H */
  47. Download patch openjpeg/src/lib/openjp2/pi.c
  48. Download patch openjpeg/src/lib/openjp2/opj_stdint.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_stdint.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_stdint.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2012, Mathieu Malaterre <mathieu.malaterre@gmail.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_STDINT_H +#define OPJ_STDINT_H + +#include "opj_config.h" +#ifdef OPJ_HAVE_STDINT_H +#include <stdint.h> +#else +#if defined(_WIN32) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +#error unsupported platform +#endif +#endif + +#endif /* OPJ_STDINT_H */
  49. Download patch openjpeg/src/lib/openjp2/mqc.h
  50. Download patch openjpeg/src/lib/openjp2/j2k.h
  51. Download patch openjpeg/CHANGELOG.md
  52. Download patch openjpeg/src/lib/openjp2/cio.c
  53. Download patch openjpeg/src/lib/openjp2/pi.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/pi.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/pi.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,190 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_PI_H +#define OPJ_PI_H +/** +@file pi.h +@brief Implementation of a packet iterator (PI) + +The functions in PI.C have for goal to realize a packet iterator that permits to get the next +packet following the progression order and change of it. The functions in PI.C are used +by some function in T2.C. +*/ + +/** @defgroup PI PI - Implementation of a packet iterator */ +/*@{*/ + +/** +FIXME DOC +*/ +typedef struct opj_pi_resolution { + OPJ_UINT32 pdx, pdy; + OPJ_UINT32 pw, ph; +} opj_pi_resolution_t; + +/** +FIXME DOC +*/ +typedef struct opj_pi_comp { + OPJ_UINT32 dx, dy; + /** number of resolution levels */ + OPJ_UINT32 numresolutions; + opj_pi_resolution_t *resolutions; +} opj_pi_comp_t; + +/** +Packet iterator +*/ +typedef struct opj_pi_iterator { + /** Enabling Tile part generation*/ + OPJ_BYTE tp_on; + /** precise if the packet has been already used (useful for progression order change) */ + OPJ_INT16 *include; + /** Number of elements in include array */ + OPJ_UINT32 include_size; + /** layer step used to localize the packet in the include vector */ + OPJ_UINT32 step_l; + /** resolution step used to localize the packet in the include vector */ + OPJ_UINT32 step_r; + /** component step used to localize the packet in the include vector */ + OPJ_UINT32 step_c; + /** precinct step used to localize the packet in the include vector */ + OPJ_UINT32 step_p; + /** component that identify the packet */ + OPJ_UINT32 compno; + /** resolution that identify the packet */ + OPJ_UINT32 resno; + /** precinct that identify the packet */ + OPJ_UINT32 precno; + /** layer that identify the packet */ + OPJ_UINT32 layno; + /** 0 if the first packet */ + OPJ_BOOL first; + /** progression order change information */ + opj_poc_t poc; + /** number of components in the image */ + OPJ_UINT32 numcomps; + /** Components*/ + opj_pi_comp_t *comps; + /** FIXME DOC*/ + OPJ_INT32 tx0, ty0, tx1, ty1; + /** FIXME DOC*/ + OPJ_INT32 x, y; + /** FIXME DOC*/ + OPJ_UINT32 dx, dy; +} opj_pi_iterator_t; + +/** @name Exported functions */ +/*@{*/ +/* ----------------------------------------------------------------------- */ +/** + * Creates a packet iterator for encoding. + * + * @param image the image being encoded. + * @param cp the coding parameters. + * @param tileno index of the tile being encoded. + * @param t2_mode the type of pass for generating the packet iterator + * + * @return a list of packet iterator that points to the first packet of the tile (not true). +*/ +opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *image, + opj_cp_t *cp, + OPJ_UINT32 tileno, + J2K_T2_MODE t2_mode); + +/** + * Updates the encoding parameters of the codec. + * + * @param p_image the image being encoded. + * @param p_cp the coding parameters. + * @param p_tile_no index of the tile being encoded. +*/ +void opj_pi_update_encoding_parameters(const opj_image_t *p_image, + opj_cp_t *p_cp, + OPJ_UINT32 p_tile_no); + +/** +Modify the packet iterator for enabling tile part generation +@param pi Handle to the packet iterator generated in pi_initialise_encode +@param cp Coding parameters +@param tileno Number that identifies the tile for which to list the packets +@param pino FIXME DOC +@param tpnum Tile part number of the current tile +@param tppos The position of the tile part flag in the progression order +@param t2_mode FIXME DOC +*/ +void opj_pi_create_encode(opj_pi_iterator_t *pi, + opj_cp_t *cp, + OPJ_UINT32 tileno, + OPJ_UINT32 pino, + OPJ_UINT32 tpnum, + OPJ_INT32 tppos, + J2K_T2_MODE t2_mode); + +/** +Create a packet iterator for Decoder +@param image Raw image for which the packets will be listed +@param cp Coding parameters +@param tileno Number that identifies the tile for which to list the packets +@return Returns a packet iterator that points to the first packet of the tile +@see opj_pi_destroy +*/ +opj_pi_iterator_t *opj_pi_create_decode(opj_image_t * image, + opj_cp_t * cp, + OPJ_UINT32 tileno); +/** + * Destroys a packet iterator array. + * + * @param p_pi the packet iterator array to destroy. + * @param p_nb_elements the number of elements in the array. + */ +void opj_pi_destroy(opj_pi_iterator_t *p_pi, + OPJ_UINT32 p_nb_elements); + +/** +Modify the packet iterator to point to the next packet +@param pi Packet iterator to modify +@return Returns false if pi pointed to the last packet or else returns true +*/ +OPJ_BOOL opj_pi_next(opj_pi_iterator_t * pi); +/* ----------------------------------------------------------------------- */ +/*@}*/ + +/*@}*/ + +#endif /* OPJ_PI_H */
  54. Download patch openjpeg/src/lib/openjp2/image.c
  55. Download patch openjpeg/src/lib/openjp2/tcd.c
  56. Download patch openjpeg/src/lib/openjp2/cio.h
  57. Download patch debian/patches/series

    --- 9.22~dfsg-2.1/debian/patches/series 2018-04-20 10:28:29.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/debian/patches/series 2018-04-24 17:34:31.000000000 +0000 @@ -1,5 +1,3 @@ -0001-Fix-bug-697459-Buffer-overflow-in-fill_threshold_buf.patch -0002-pdfwrite-Guard-against-trying-to-output-an-infinite-.patch 2001_docdir_fix_for_debian.patch 2002_gs_man_fix_debian.patch 2003_support_multiarch.patch @@ -9,3 +7,5 @@ 2007_suggest_install_ghostscript-doc_in_code.patch 2008_mention_ghostscript-x_in_docs.patch 2010_add_build_timestamp_setting.patch +CVE-2016-10317.patch +CVE-2018-10194.patch
  58. Download patch openjpeg/THANKS.md

    --- 9.22~dfsg-2.1/openjpeg/THANKS.md 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/THANKS.md 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,39 @@ +# OpenJPEG THANKS file + +Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements, +or submitting actual code. Here is a list of these people. Help me keep +it complete and exempt of errors. + +* Giuseppe Baruffa +* Ben Boeckel +* Aaron Boxer +* David Burken +* Matthieu Darbois +* Rex Dieter +* Herve Drolon +* Antonin Descampe +* Francois-Olivier Devaux +* Parvatha Elangovan +* Jerôme Fimes +* Bob Friesenhahn +* Kaori Hagihara +* Luc Hermitte +* Luis Ibanez +* David Janssens +* Hans Johnson +* Callum Lerwick +* Ke Liu (Tencent's Xuanwu LAB) +* Sebastien Lugan +* Benoit Macq +* Mathieu Malaterre +* Julien Malik +* Arnaud Maye +* Vincent Nicolas +* Aleksander Nikolic (Cisco Talos) +* Glenn Pearson +* Even Rouault +* Dzonatas Sol +* Winfried Szukalski +* Vincent Torri +* Yannick Verschueren +* Peter Wimmer
  59. Download patch openjpeg/src/lib/openjp2/t1_luts.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/t1_luts.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/t1_luts.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,175 @@ +/* This file was automatically generated by t1_generate_luts.c */ + +static const OPJ_BYTE lut_ctxno_zc[2048] = { + 0, 1, 3, 3, 1, 2, 3, 3, 5, 6, 7, 7, 6, 6, 7, 7, 0, 1, 3, 3, 1, 2, 3, 3, 5, 6, 7, 7, 6, 6, 7, 7, + 5, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 5, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 1, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, 1, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, + 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 1, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, 1, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, + 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 2, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, 2, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, + 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 0, 1, 5, 6, 1, 2, 6, 6, 3, 3, 7, 7, 3, 3, 7, 7, 0, 1, 5, 6, 1, 2, 6, 6, 3, 3, 7, 7, 3, 3, 7, 7, + 3, 3, 7, 7, 3, 3, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, 3, 3, 7, 7, 3, 3, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, + 1, 2, 6, 6, 2, 2, 6, 6, 3, 3, 7, 7, 3, 3, 7, 7, 1, 2, 6, 6, 2, 2, 6, 6, 3, 3, 7, 7, 3, 3, 7, 7, + 3, 3, 7, 7, 3, 3, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, 3, 3, 7, 7, 3, 3, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, + 5, 6, 8, 8, 6, 6, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 5, 6, 8, 8, 6, 6, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, + 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, + 6, 6, 8, 8, 6, 6, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 6, 6, 8, 8, 6, 6, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, + 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, + 1, 2, 6, 6, 2, 2, 6, 6, 3, 3, 7, 7, 3, 3, 7, 7, 1, 2, 6, 6, 2, 2, 6, 6, 3, 3, 7, 7, 3, 3, 7, 7, + 3, 3, 7, 7, 3, 3, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, 3, 3, 7, 7, 3, 3, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, + 2, 2, 6, 6, 2, 2, 6, 6, 3, 3, 7, 7, 3, 3, 7, 7, 2, 2, 6, 6, 2, 2, 6, 6, 3, 3, 7, 7, 3, 3, 7, 7, + 3, 3, 7, 7, 3, 3, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, 3, 3, 7, 7, 3, 3, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, + 6, 6, 8, 8, 6, 6, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 6, 6, 8, 8, 6, 6, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, + 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, + 6, 6, 8, 8, 6, 6, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 6, 6, 8, 8, 6, 6, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, + 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, 7, 7, 8, 8, + 0, 1, 3, 3, 1, 2, 3, 3, 5, 6, 7, 7, 6, 6, 7, 7, 0, 1, 3, 3, 1, 2, 3, 3, 5, 6, 7, 7, 6, 6, 7, 7, + 5, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 5, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 1, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, 1, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, + 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 1, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, 1, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, + 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 2, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, 2, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, + 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 4, 4, 3, 3, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 0, 3, 1, 4, 3, 6, 4, 7, 1, 4, 2, 5, 4, 7, 5, 7, 0, 3, 1, 4, 3, 6, 4, 7, 1, 4, 2, 5, 4, 7, 5, 7, + 1, 4, 2, 5, 4, 7, 5, 7, 2, 5, 2, 5, 5, 7, 5, 7, 1, 4, 2, 5, 4, 7, 5, 7, 2, 5, 2, 5, 5, 7, 5, 7, + 3, 6, 4, 7, 6, 8, 7, 8, 4, 7, 5, 7, 7, 8, 7, 8, 3, 6, 4, 7, 6, 8, 7, 8, 4, 7, 5, 7, 7, 8, 7, 8, + 4, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, 4, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, + 1, 4, 2, 5, 4, 7, 5, 7, 2, 5, 2, 5, 5, 7, 5, 7, 1, 4, 2, 5, 4, 7, 5, 7, 2, 5, 2, 5, 5, 7, 5, 7, + 2, 5, 2, 5, 5, 7, 5, 7, 2, 5, 2, 5, 5, 7, 5, 7, 2, 5, 2, 5, 5, 7, 5, 7, 2, 5, 2, 5, 5, 7, 5, 7, + 4, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, 4, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, + 5, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, + 3, 6, 4, 7, 6, 8, 7, 8, 4, 7, 5, 7, 7, 8, 7, 8, 3, 6, 4, 7, 6, 8, 7, 8, 4, 7, 5, 7, 7, 8, 7, 8, + 4, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, 4, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, + 6, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 6, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, + 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, + 4, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, 4, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, + 5, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, 5, 7, 5, 7, 7, 8, 7, 8, + 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, + 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8 +}; + +static const OPJ_BYTE lut_ctxno_sc[256] = { + 0x9, 0x9, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xc, 0xc, 0xd, 0xb, 0xc, 0xc, 0xd, 0xb, + 0x9, 0x9, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xc, 0xc, 0xb, 0xd, 0xc, 0xc, 0xb, 0xd, + 0xc, 0xc, 0xd, 0xd, 0xc, 0xc, 0xb, 0xb, 0xc, 0x9, 0xd, 0xa, 0x9, 0xc, 0xa, 0xb, + 0xc, 0xc, 0xb, 0xb, 0xc, 0xc, 0xd, 0xd, 0xc, 0x9, 0xb, 0xa, 0x9, 0xc, 0xa, 0xd, + 0x9, 0x9, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xc, 0xc, 0xd, 0xb, 0xc, 0xc, 0xd, 0xb, + 0x9, 0x9, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xc, 0xc, 0xb, 0xd, 0xc, 0xc, 0xb, 0xd, + 0xc, 0xc, 0xd, 0xd, 0xc, 0xc, 0xb, 0xb, 0xc, 0x9, 0xd, 0xa, 0x9, 0xc, 0xa, 0xb, + 0xc, 0xc, 0xb, 0xb, 0xc, 0xc, 0xd, 0xd, 0xc, 0x9, 0xb, 0xa, 0x9, 0xc, 0xa, 0xd, + 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xd, 0xb, 0xd, 0xb, 0xd, 0xb, 0xd, 0xb, + 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0x9, 0x9, 0xd, 0xb, 0xc, 0xc, 0xd, 0xb, 0xc, 0xc, + 0xd, 0xd, 0xd, 0xd, 0xb, 0xb, 0xb, 0xb, 0xd, 0xa, 0xd, 0xa, 0xa, 0xb, 0xa, 0xb, + 0xd, 0xd, 0xc, 0xc, 0xb, 0xb, 0xc, 0xc, 0xd, 0xa, 0xc, 0x9, 0xa, 0xb, 0x9, 0xc, + 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0x9, 0x9, 0xb, 0xd, 0xc, 0xc, 0xb, 0xd, 0xc, 0xc, + 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xb, 0xd, 0xb, 0xd, 0xb, 0xd, 0xb, 0xd, + 0xb, 0xb, 0xc, 0xc, 0xd, 0xd, 0xc, 0xc, 0xb, 0xa, 0xc, 0x9, 0xa, 0xd, 0x9, 0xc, + 0xb, 0xb, 0xb, 0xb, 0xd, 0xd, 0xd, 0xd, 0xb, 0xa, 0xb, 0xa, 0xa, 0xd, 0xa, 0xd +}; + +static const OPJ_BYTE lut_spb[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, + 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1 +}; + +static const OPJ_INT16 lut_nmsedec_sig[1U << T1_NMSEDEC_BITS] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0180, 0x0300, 0x0480, 0x0600, 0x0780, 0x0900, 0x0a80, + 0x0c00, 0x0d80, 0x0f00, 0x1080, 0x1200, 0x1380, 0x1500, 0x1680, + 0x1800, 0x1980, 0x1b00, 0x1c80, 0x1e00, 0x1f80, 0x2100, 0x2280, + 0x2400, 0x2580, 0x2700, 0x2880, 0x2a00, 0x2b80, 0x2d00, 0x2e80, + 0x3000, 0x3180, 0x3300, 0x3480, 0x3600, 0x3780, 0x3900, 0x3a80, + 0x3c00, 0x3d80, 0x3f00, 0x4080, 0x4200, 0x4380, 0x4500, 0x4680, + 0x4800, 0x4980, 0x4b00, 0x4c80, 0x4e00, 0x4f80, 0x5100, 0x5280, + 0x5400, 0x5580, 0x5700, 0x5880, 0x5a00, 0x5b80, 0x5d00, 0x5e80, + 0x6000, 0x6180, 0x6300, 0x6480, 0x6600, 0x6780, 0x6900, 0x6a80, + 0x6c00, 0x6d80, 0x6f00, 0x7080, 0x7200, 0x7380, 0x7500, 0x7680 +}; + +static const OPJ_INT16 lut_nmsedec_sig0[1U << T1_NMSEDEC_BITS] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080, + 0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200, + 0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400, + 0x0480, 0x0500, 0x0580, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780, + 0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b80, 0x0c00, + 0x0c80, 0x0d00, 0x0e00, 0x0e80, 0x0f00, 0x1000, 0x1080, 0x1180, + 0x1200, 0x1300, 0x1380, 0x1480, 0x1500, 0x1600, 0x1700, 0x1780, + 0x1880, 0x1980, 0x1a80, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00, + 0x2000, 0x2100, 0x2200, 0x2300, 0x2400, 0x2500, 0x2680, 0x2780, + 0x2880, 0x2980, 0x2b00, 0x2c00, 0x2d00, 0x2e80, 0x2f80, 0x3100, + 0x3200, 0x3380, 0x3480, 0x3600, 0x3700, 0x3880, 0x3a00, 0x3b00, + 0x3c80, 0x3e00, 0x3f80, 0x4080, 0x4200, 0x4380, 0x4500, 0x4680, + 0x4800, 0x4980, 0x4b00, 0x4c80, 0x4e00, 0x4f80, 0x5180, 0x5300, + 0x5480, 0x5600, 0x5800, 0x5980, 0x5b00, 0x5d00, 0x5e80, 0x6080, + 0x6200, 0x6400, 0x6580, 0x6780, 0x6900, 0x6b00, 0x6d00, 0x6e80, + 0x7080, 0x7280, 0x7480, 0x7600, 0x7800, 0x7a00, 0x7c00, 0x7e00 +}; + +static const OPJ_INT16 lut_nmsedec_ref[1U << T1_NMSEDEC_BITS] = { + 0x1800, 0x1780, 0x1700, 0x1680, 0x1600, 0x1580, 0x1500, 0x1480, + 0x1400, 0x1380, 0x1300, 0x1280, 0x1200, 0x1180, 0x1100, 0x1080, + 0x1000, 0x0f80, 0x0f00, 0x0e80, 0x0e00, 0x0d80, 0x0d00, 0x0c80, + 0x0c00, 0x0b80, 0x0b00, 0x0a80, 0x0a00, 0x0980, 0x0900, 0x0880, + 0x0800, 0x0780, 0x0700, 0x0680, 0x0600, 0x0580, 0x0500, 0x0480, + 0x0400, 0x0380, 0x0300, 0x0280, 0x0200, 0x0180, 0x0100, 0x0080, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380, + 0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780, + 0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b00, 0x0b80, + 0x0c00, 0x0c80, 0x0d00, 0x0d80, 0x0e00, 0x0e80, 0x0f00, 0x0f80, + 0x1000, 0x1080, 0x1100, 0x1180, 0x1200, 0x1280, 0x1300, 0x1380, + 0x1400, 0x1480, 0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780 +}; + +static const OPJ_INT16 lut_nmsedec_ref0[1U << T1_NMSEDEC_BITS] = { + 0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x1b00, 0x1a80, 0x1980, + 0x1880, 0x1780, 0x1700, 0x1600, 0x1500, 0x1480, 0x1380, 0x1300, + 0x1200, 0x1180, 0x1080, 0x1000, 0x0f00, 0x0e80, 0x0e00, 0x0d00, + 0x0c80, 0x0c00, 0x0b80, 0x0a80, 0x0a00, 0x0980, 0x0900, 0x0880, + 0x0800, 0x0780, 0x0700, 0x0680, 0x0600, 0x0580, 0x0580, 0x0500, + 0x0480, 0x0400, 0x0400, 0x0380, 0x0300, 0x0300, 0x0280, 0x0280, + 0x0200, 0x0200, 0x0180, 0x0180, 0x0100, 0x0100, 0x0100, 0x0080, + 0x0080, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080, + 0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200, + 0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400, + 0x0480, 0x0500, 0x0580, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780, + 0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b80, 0x0c00, + 0x0c80, 0x0d00, 0x0e00, 0x0e80, 0x0f00, 0x1000, 0x1080, 0x1180, + 0x1200, 0x1300, 0x1380, 0x1480, 0x1500, 0x1600, 0x1700, 0x1780, + 0x1880, 0x1980, 0x1a80, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00 +}; +
  60. Download patch openjpeg/src/lib/openjp2/image.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/image.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/image.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_IMAGE_H +#define OPJ_IMAGE_H +/** +@file image.h +@brief Implementation of operations on images (IMAGE) + +The functions in IMAGE.C have for goal to realize operations on images. +*/ + +struct opj_image; +struct opj_cp; + +/** @defgroup IMAGE IMAGE - Implementation of operations on images */ +/*@{*/ + +/** + * Create an empty image + * + * @return returns an empty image if successful, returns NULL otherwise + */ +opj_image_t* opj_image_create0(void); + + + +/** + * Updates the components characteristics of the image from the coding parameters. + * + * @param p_image_header the image header to update. + * @param p_cp the coding parameters from which to update the image. + */ +void opj_image_comp_header_update(opj_image_t * p_image, + const struct opj_cp* p_cp); + +void opj_copy_image_header(const opj_image_t* p_image_src, + opj_image_t* p_image_dest); + +/*@}*/ + +#endif /* OPJ_IMAGE_H */ +
  61. Download patch openjpeg/src/lib/openjp2/function_list.c

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/function_list.c 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/function_list.c 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,117 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "opj_includes.h" + +/** + * Default size of the validation list, if not sufficient, data will be reallocated with a double size. + */ +#define OPJ_VALIDATION_SIZE 10 + +opj_procedure_list_t * opj_procedure_list_create() +{ + /* memory allocation */ + opj_procedure_list_t * l_validation = (opj_procedure_list_t *) opj_calloc(1, + sizeof(opj_procedure_list_t)); + if (! l_validation) { + return 00; + } + /* initialization */ + l_validation->m_nb_max_procedures = OPJ_VALIDATION_SIZE; + l_validation->m_procedures = (opj_procedure*)opj_calloc(OPJ_VALIDATION_SIZE, + sizeof(opj_procedure)); + if (! l_validation->m_procedures) { + opj_free(l_validation); + return 00; + } + return l_validation; +} + +void opj_procedure_list_destroy(opj_procedure_list_t * p_list) +{ + if (! p_list) { + return; + } + /* initialization */ + if (p_list->m_procedures) { + opj_free(p_list->m_procedures); + } + opj_free(p_list); +} + +OPJ_BOOL opj_procedure_list_add_procedure(opj_procedure_list_t * + p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager) +{ + + assert(p_manager != NULL); + + if (p_validation_list->m_nb_max_procedures == + p_validation_list->m_nb_procedures) { + opj_procedure * new_procedures; + + p_validation_list->m_nb_max_procedures += OPJ_VALIDATION_SIZE; + new_procedures = (opj_procedure*)opj_realloc( + p_validation_list->m_procedures, + p_validation_list->m_nb_max_procedures * sizeof(opj_procedure)); + if (! new_procedures) { + opj_free(p_validation_list->m_procedures); + p_validation_list->m_nb_max_procedures = 0; + p_validation_list->m_nb_procedures = 0; + opj_event_msg(p_manager, EVT_ERROR, + "Not enough memory to add a new validation procedure\n"); + return OPJ_FALSE; + } else { + p_validation_list->m_procedures = new_procedures; + } + } + p_validation_list->m_procedures[p_validation_list->m_nb_procedures] = + p_procedure; + ++p_validation_list->m_nb_procedures; + + return OPJ_TRUE; +} + +OPJ_UINT32 opj_procedure_list_get_nb_procedures(opj_procedure_list_t * + p_validation_list) +{ + return p_validation_list->m_nb_procedures; +} + +opj_procedure* opj_procedure_list_get_first_procedure(opj_procedure_list_t * + p_validation_list) +{ + return p_validation_list->m_procedures; +} + +void opj_procedure_list_clear(opj_procedure_list_t * p_validation_list) +{ + p_validation_list->m_nb_procedures = 0; +}
  62. Download patch openjpeg/src/lib/openjp2/event.c

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/event.c 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/event.c 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,151 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR + * Copyright (c) 2012, CS Systemes d'Information, France + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "opj_includes.h" + +/* ========================================================== + Utility functions + ==========================================================*/ + +#ifdef OPJ_CODE_NOT_USED +#ifndef _WIN32 +static char* +i2a(unsigned i, char *a, unsigned r) +{ + if (i / r > 0) { + a = i2a(i / r, a, r); + } + *a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i % r]; + return a + 1; +} + +/** + Transforms integer i into an ascii string and stores the result in a; + string is encoded in the base indicated by r. + @param i Number to be converted + @param a String result + @param r Base of value; must be in the range 2 - 36 + @return Returns a +*/ +static char * +_itoa(int i, char *a, int r) +{ + r = ((r < 2) || (r > 36)) ? 10 : r; + if (i < 0) { + *a = '-'; + *i2a(-i, a + 1, r) = 0; + } else { + *i2a(i, a, r) = 0; + } + return a; +} + +#endif /* !_WIN32 */ +#endif + +/* ----------------------------------------------------------------------- */ +/** + * Default callback function. + * Do nothing. + */ +static void opj_default_callback(const char *msg, void *client_data) +{ + OPJ_ARG_NOT_USED(msg); + OPJ_ARG_NOT_USED(client_data); +} + +/* ----------------------------------------------------------------------- */ + + +/* ----------------------------------------------------------------------- */ +OPJ_BOOL opj_event_msg(opj_event_mgr_t* p_event_mgr, OPJ_INT32 event_type, + const char *fmt, ...) +{ +#define OPJ_MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */ + opj_msg_callback msg_handler = 00; + void * l_data = 00; + + if (p_event_mgr != 00) { + switch (event_type) { + case EVT_ERROR: + msg_handler = p_event_mgr->error_handler; + l_data = p_event_mgr->m_error_data; + break; + case EVT_WARNING: + msg_handler = p_event_mgr->warning_handler; + l_data = p_event_mgr->m_warning_data; + break; + case EVT_INFO: + msg_handler = p_event_mgr->info_handler; + l_data = p_event_mgr->m_info_data; + break; + default: + break; + } + if (msg_handler == 00) { + return OPJ_FALSE; + } + } else { + return OPJ_FALSE; + } + + if ((fmt != 00) && (p_event_mgr != 00)) { + va_list arg; + char message[OPJ_MSG_SIZE]; + memset(message, 0, OPJ_MSG_SIZE); + /* initialize the optional parameter list */ + va_start(arg, fmt); + /* parse the format string and put the result in 'message' */ + vsnprintf(message, OPJ_MSG_SIZE, fmt, arg); + /* force zero termination for Windows _vsnprintf() of old MSVC */ + message[OPJ_MSG_SIZE - 1] = '\0'; + /* deinitialize the optional parameter list */ + va_end(arg); + + /* output the message to the user program */ + msg_handler(message, l_data); + } + + return OPJ_TRUE; +} + +void opj_set_default_event_handler(opj_event_mgr_t * p_manager) +{ + p_manager->m_error_data = 00; + p_manager->m_warning_data = 00; + p_manager->m_info_data = 00; + p_manager->error_handler = opj_default_callback; + p_manager->info_handler = opj_default_callback; + p_manager->warning_handler = opj_default_callback; +} +
  63. Download patch openjpeg/src/CMakeLists.txt

    --- 9.22~dfsg-2.1/openjpeg/src/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/CMakeLists.txt 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,12 @@ +# required dep for server: +#if(BUILD_JPIP_SERVER) +# find_package(CURL REQUIRED) +# find_package(FCGI REQUIRED) +# find_package(Threads REQUIRED) +# if(NOT CMAKE_USE_PTHREADS_INIT) +# message(FATAL_ERROR "Only pthread are supported") +# endif() +#endif() + +#add_subdirectory(lib) +#add_subdirectory(bin)
  64. Download patch debian/patches/CVE-2018-10194.patch

    --- 9.22~dfsg-2.1/debian/patches/CVE-2018-10194.patch 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/debian/patches/CVE-2018-10194.patch 2018-04-24 17:34:31.000000000 +0000 @@ -0,0 +1,43 @@ +From 39b1e54b2968620723bf32e96764c88797714879 Mon Sep 17 00:00:00 2001 +From: Ken Sharp <ken.sharp@artifex.com> +Date: Wed, 18 Apr 2018 15:46:32 +0100 +Subject: [PATCH] pdfwrite - Guard against trying to output an infinite number + +Bug #699255 " Buffer overflow on pprintg1 due to mishandle postscript file data to pdf" + +The file uses an enormous parameter to xyxhow, causing an overflow in +the calculation of text positioning (value > 1e39). + +Since this is basically a nonsense value, and PostScript only supports +real values up to 1e38, this patch follows the same approach as for +a degenerate CTM, and treats it as 0. + +Adobe Acrobat Distiller throws a limitcheck error, so we could do that +instead if this approach proves to be a problem. +--- + devices/vector/gdevpdts.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/devices/vector/gdevpdts.c b/devices/vector/gdevpdts.c +index 848ad78..172fe6b 100644 +--- a/devices/vector/gdevpdts.c ++++ b/devices/vector/gdevpdts.c +@@ -103,9 +103,14 @@ append_text_move(pdf_text_state_t *pts, double dw) + static int + set_text_distance(gs_point *pdist, double dx, double dy, const gs_matrix *pmat) + { +- int code = gs_distance_transform_inverse(dx, dy, pmat, pdist); ++ int code; + double rounded; + ++ if (dx > 1e38 || dy > 1e38) ++ code = gs_error_undefinedresult; ++ else ++ code = gs_distance_transform_inverse(dx, dy, pmat, pdist); ++ + if (code == gs_error_undefinedresult) { + /* The CTM is degenerate. + Can't know the distance in user space. +-- +2.9.1 +
  65. Download patch openjpeg/src/lib/openjp2/tcd.h
  66. Download patch openjpeg/.travis.yml

    --- 9.22~dfsg-2.1/openjpeg/.travis.yml 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/.travis.yml 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,153 @@ +language: cpp + +matrix: + include: +# OSX + - os: osx + compiler: clang + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1 + +# Test code style + - os: linux + compiler: clang-3.8 + env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_CHECK_STYLE=1 OPJ_CI_SKIP_TESTS=1 + addons: + apt: + sources: + - llvm-toolchain-precise-3.8 + - ubuntu-toolchain-r-test + packages: + - clang-3.8 + - flip + +# Performance test with GCC + - os: linux + compiler: g++ + dist: precise + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1 OPJ_CI_PERF_TESTS=1 + +# Test compilation with AVX2 + - os: linux + # "sudo: yes" and "dist: trusty" give us a worker with the AVX2 instruction set + sudo: yes + dist: trusty + compiler: clang-3.8 + env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_INSTRUCTION_SETS="-mavx2" OPJ_CI_BUILD_CONFIGURATION=Release + addons: + apt: + sources: + - llvm-toolchain-precise-3.8 + - ubuntu-toolchain-r-test + packages: + - clang-3.8 + +# Test multi-threading + - os: linux + compiler: g++ + dist: precise + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2 + +# Test 32-bit compilation + - os: linux + compiler: g++ + env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release + addons: + apt: + packages: + - gcc-multilib + - g++-multilib + +# Profile code (gcc -pg) + - os: linux + compiler: g++ + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_PROFILE=1 + addons: + apt: + packages: + - valgrind + +# Test under ASAN + - os: linux + compiler: clang + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1 + +# Test with CLang 3.8 + - os: linux + compiler: clang-3.8 + env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_PERF_TESTS=1 OPJ_CI_BUILD_FUZZERS=1 + addons: + apt: + sources: + - llvm-toolchain-precise-3.8 + - ubuntu-toolchain-r-test + packages: + - clang-3.8 + +# Test with mingw 32 bit + - os: linux + compiler: x86_64-w64-mingw32-g++ + env: OPJ_CI_CC=x86_64-w64-mingw32-gcc OPJ_CI_CXX=x86_64-w64-mingw32-g++ OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release + addons: + apt: + packages: + - gcc-mingw-w64-base + - binutils-mingw-w64-i686 + - gcc-mingw-w64-i686 + - gcc-mingw-w64 + - g++-mingw-w64-i686 + - gcc-multilib + - g++-multilib + +# Test with mingw 64 bit + - os: linux + compiler: x86_64-w64-mingw32-g++ + env: OPJ_CI_CC=x86_64-w64-mingw32-gcc OPJ_CI_CXX=x86_64-w64-mingw32-g++ OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release + addons: + apt: + packages: + - gcc-mingw-w64-base + - binutils-mingw-w64-x86-64 + - gcc-mingw-w64-x86-64 + - gcc-mingw-w64 + - g++-mingw-w64-x86-64 + +# Test with gcc 4.8 + - os: linux + compiler: g++-4.8 + env: OPJ_CI_CC=gcc-4.8 OPJ_CI_CXX=g++-4.8 OPJ_CI_ABI_CHECK=1 + dist: precise + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-4.8 + - g++-4.8 + - libelf-dev + - elfutils + - texinfo + - exuberant-ctags + +install: + - ./tools/travis-ci/install.sh + +script: + - ./tools/travis-ci/run.sh + - ./tools/travis-ci/abi-check.sh + +before_deploy: + - export OPJ_RELEASE_PKG_FILE=$(ls build/openjpeg-${TRAVIS_TAG}*) + - echo "deploying $OPJ_RELEASE_PKG_FILE to GitHub releases" + +deploy: + provider: releases + api_key: + secure: Npi13uOffALCVNwea4p4q8v85Lo/WsRqaeZQcWrAkt8MxRnfvWQtmnuwmHnVB6Cig+T1lVUHrklOaJIApIb6nkGq3CS/9bD8+SCS2NEdAAP/QYWnBi0ubWXVMRyDLypmwRpzLNSZ0xLYGFUl2PjieZYKRcz1dd/J7S+FnXhPtdjXweq0FS63zTcMe7ggjfmzSOWUCEFmMjZPaM0Be+3PweieCO1dxlHuy7ugCkx2S7d+5hNsicIhQmTADjqtJAkHoMhYqu6/yLFxhjO/+f938PATFULdODTvjCsUwdN/ySWi1Oj4uPAntfytZP7H6YrzLh8dS73QCsdkhhDJIgJskHIBSbRyyEVUnOvQgD9VaBVGHtc1KtZQTwc41OUO3BGPHl97s3oX6bqWqo/L53dB3TPHGx+1+2HL/F0zaDZuHhAKMkPwe8LFPMPB/ur65zXMHjnWb2ZTVVdoIvkbQ7nu8ApI60ejxocYBsEyAuC2CPXU2ki4jdEhm0E1hIziWNE9/LTuM17ziQuJ6WpXOSMrfP4o5aVDmLp5ZGBSocrspOksgyI9XogHaO/r+Y6N3exy+giObFfMHkZVUpsKrKmtOJ7TC1Vg5HsYGlWW8RN8dkJV47bUXm9K4sMos9eYMUt/czykPAs+132cogpII3QxXpFZQqZg6SEPVfOiyqQzTUI= + file_glob: true + file: "${OPJ_RELEASE_PKG_FILE}" + skip_cleanup: true + on: + repo: uclouvain/openjpeg + tags: true + condition: "$OPJ_CI_INCLUDE_IF_DEPLOY = 1" +
  67. Download patch openjpeg/src/lib/openjp2/function_list.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/function_list.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/function_list.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,134 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_FUNCTION_LIST_H +#define OPJ_FUNCTION_LIST_H + +/** + * @file function_list.h + * @brief Implementation of a list of procedures. + + * The functions in validation.c aims to have access to a list of procedures. +*/ + +/** @defgroup VAL VAL - validation procedure*/ +/*@{*/ + +/************************************************************************************************** + ***************************************** FORWARD DECLARATION ************************************ + **************************************************************************************************/ + +/** + * declare a function pointer + */ +typedef void (*opj_procedure)(void); + +/** + * A list of procedures. +*/ +typedef struct opj_procedure_list { + /** + * The number of validation procedures. + */ + OPJ_UINT32 m_nb_procedures; + /** + * The number of the array of validation procedures. + */ + OPJ_UINT32 m_nb_max_procedures; + /** + * The array of procedures. + */ + opj_procedure * m_procedures; + +} opj_procedure_list_t; + +/* ----------------------------------------------------------------------- */ + +/** + * Creates a validation list. + * + * @return the newly created validation list. + */ +opj_procedure_list_t * opj_procedure_list_create(void); + +/** + * Destroys a validation list. + * + * @param p_list the list to destroy. + */ +void opj_procedure_list_destroy(opj_procedure_list_t * p_list); + +/** + * Adds a new validation procedure. + * + * @param p_validation_list the list of procedure to modify. + * @param p_procedure the procedure to add. + * @param p_manager the user event manager. + * + * @return OPJ_TRUE if the procedure could be added. + */ +OPJ_BOOL opj_procedure_list_add_procedure(opj_procedure_list_t * + p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager); + +/** + * Gets the number of validation procedures. + * + * @param p_validation_list the list of procedure to modify. + * + * @return the number of validation procedures. + */ +OPJ_UINT32 opj_procedure_list_get_nb_procedures(opj_procedure_list_t * + p_validation_list); + +/** + * Gets the pointer on the first validation procedure. This function is similar to the C++ + * iterator class to iterate through all the procedures inside the validation list. + * the caller does not take ownership of the pointer. + * + * @param p_validation_list the list of procedure to get the first procedure from. + * + * @return a pointer to the first procedure. + */ +opj_procedure* opj_procedure_list_get_first_procedure(opj_procedure_list_t * + p_validation_list); + + +/** + * Clears the list of validation procedures. + * + * @param p_validation_list the list of procedure to clear. + * + */ +void opj_procedure_list_clear(opj_procedure_list_t * p_validation_list); +/*@}*/ + +#endif /* OPJ_FUNCTION_LIST_H */ +
  68. Download patch openjpeg/src/lib/openjp2/event.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/event.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/event.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,108 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR + * Copyright (c) 2012, CS Systemes d'Information, France + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_EVENT_H +#define OPJ_EVENT_H +/** +@file event.h +@brief Implementation of a event callback system + +The functions in EVENT.C have for goal to send output messages (errors, warnings, debug) to the user. +*/ +/** +Message handler object +used for +<ul> +<li>Error messages +<li>Warning messages +<li>Debugging messages +</ul> +*/ +typedef struct opj_event_mgr { + /** Data to call the event manager upon */ + void * m_error_data; + /** Data to call the event manager upon */ + void * m_warning_data; + /** Data to call the event manager upon */ + void * m_info_data; + /** Error message callback if available, NULL otherwise */ + opj_msg_callback error_handler; + /** Warning message callback if available, NULL otherwise */ + opj_msg_callback warning_handler; + /** Debug message callback if available, NULL otherwise */ + opj_msg_callback info_handler; +} opj_event_mgr_t; + + +#define EVT_ERROR 1 /**< Error event type */ +#define EVT_WARNING 2 /**< Warning event type */ +#define EVT_INFO 4 /**< Debug event type */ + +/** @defgroup EVENT EVENT - Implementation of a event callback system */ +/*@{*/ + +/** @name Exported functions (see also openjpeg.h) */ +/*@{*/ +/* ----------------------------------------------------------------------- */ + + +/* ----------------------------------------------------------------------- */ + +/** + * Write formatted data to a string and send the string to a user callback. + * + * @param event_mgr Event handler + * @param event_type Event type or callback to use to send the message + * @param fmt Format-control string (plus optional arguments) + * + * @return Returns true if successful, returns false otherwise + */ +OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, OPJ_INT32 event_type, + const char *fmt, ...); +/* ----------------------------------------------------------------------- */ + +/** + * Set the event manager with the default callback function for the 3 levels. + */ +void opj_set_default_event_handler(opj_event_mgr_t * p_manager); + +/* +#ifdef __GNUC__ +#pragma GCC poison printf fprintf +#endif +*/ + +/*@}*/ + +/*@}*/ + +#endif /* OPJ_EVENT_H */
  69. Download patch openjpeg/.gitignore

    --- 9.22~dfsg-2.1/openjpeg/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/.gitignore 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,18 @@ +# Ignore files and directories made by `cmake .`. +CMakeFiles/ +Makefile +cmake_install.cmake +/CMakeCache.txt +/CPackConfig.cmake +/CPackSourceConfig.cmake +/CTestCustom.cmake +/LICENSE.txt +/OpenJPEGConfig.cmake +/libopenjp2.pc +/src/bin/common/opj_apps_config.h +/src/lib/openjp2/opj_config.h +/src/lib/openjp2/opj_config_private.h +scripts/opjstyle* + +# Ignore directories made by `make`. +/bin/
  70. Download patch openjpeg/src/lib/openjp2/openjpeg.c
  71. Download patch openjpeg/src/lib/openjp2/cidx_manager.c
  72. Download patch openjpeg/src/lib/openjp2/libopenjp2.pc.cmake.in

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/libopenjp2.pc.cmake.in 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/libopenjp2.pc.cmake.in 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,14 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +bindir=${prefix}/@OPENJPEG_INSTALL_BIN_DIR@ +mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@ +docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@ +libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@ +includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@ + +Name: openjp2 +Description: JPEG2000 library (Part 1 and 2) +URL: http://www.openjpeg.org/ +Version: @OPENJPEG_VERSION@ +Libs: -L${libdir} -lopenjp2 +Libs.private: -lm +Cflags: -I${includedir}
  73. Download patch openjpeg/AUTHORS.md

    --- 9.22~dfsg-2.1/openjpeg/AUTHORS.md 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/AUTHORS.md 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,21 @@ +# Authors of OpenJPEG +See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md) + +David Janssens designed and implemented the first version of OpenJPEG. + +Kaori Hagihara designed and implemented the first version of OpenJPIP. + +Jerome Fimes implemented the alpha version of OpenJPEG 2.0. + +Giuseppe Baruffa added the JPWL functionalities. + +Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0. + +Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities. + +Yannick Verschueren, +Herve Drolon, +Francois-Olivier Devaux, +Antonin Descampe + improved the libraries and utilities. +
  74. Download patch debian/patches/0001-Fix-bug-697459-Buffer-overflow-in-fill_threshold_buf.patch

    --- 9.22~dfsg-2.1/debian/patches/0001-Fix-bug-697459-Buffer-overflow-in-fill_threshold_buf.patch 2018-04-20 10:28:29.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/debian/patches/0001-Fix-bug-697459-Buffer-overflow-in-fill_threshold_buf.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -From: Ray Johnston <ray.johnston@artifex.com> -Date: Tue, 21 Nov 2017 12:48:54 -0800 -Subject: Fix bug 697459 Buffer overflow in fill_threshold_buffer -Origin: http://git.ghostscript.com/?p=ghostpdl.git;h=362ec9daadb9992b0def3520cd1dc6fa52edd1c4 -Bug-Debian: https://bugs.debian.org/860869 -Bug: https://bugs.ghostscript.com/show_bug.cgi?id=697459 -Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2016-10317 - -There was an overflow check for ht_buffer size, but none for the larger -threshold_buffer. Note that this file didn't fail on Windows because the -combination of the ht_buffer and the size of the (miscalculated due to -overflow) threshold_buffer would have exceeded the 2Gb limit. ---- - base/gxht_thresh.c | 13 ++++++++++--- - base/gxipixel.c | 2 +- - 2 files changed, 11 insertions(+), 4 deletions(-) - -diff --git a/base/gxht_thresh.c b/base/gxht_thresh.c -index 3fb840213..726861685 100644 ---- a/base/gxht_thresh.c -+++ b/base/gxht_thresh.c -@@ -711,7 +711,9 @@ gxht_thresh_image_init(gx_image_enum *penum) - space */ - max_height = (int) ceil(fixed2float(any_abs(penum->dst_height)) / - (float) penum->Height); -- if ((max_height > 0) && (penum->ht_stride * spp_out > max_int / max_height)) -+ if (max_height <= 0) -+ return -1; /* shouldn't happen, but check so we don't div by zero */ -+ if (penum->ht_stride * spp_out > max_int / max_height) - return -1; /* overflow */ - - penum->ht_buffer = -@@ -734,6 +736,11 @@ gxht_thresh_image_init(gx_image_enum *penum) - Also allow a 15 sample over run during the execution. */ - temp = (int) ceil((float) ((dev_width + 15.0) + 15.0)/16.0); - penum->line_size = bitmap_raster(temp * 16 * 8); /* The stride */ -+ if (penum->line_size > max_int / max_height) { -+ gs_free_object(penum->memory, penum->ht_buffer, "gxht_thresh"); -+ penum->ht_buffer = NULL; -+ return -1; /* thresh_buffer size overflow */ -+ } - penum->line = gs_alloc_bytes(penum->memory, penum->line_size * spp_out, - "gxht_thresh"); - penum->thresh_buffer = gs_alloc_bytes(penum->memory, -@@ -754,7 +761,7 @@ gxht_thresh_image_init(gx_image_enum *penum) - } - - static void --fill_threshhold_buffer(byte *dest_strip, byte *src_strip, int src_width, -+fill_threshold_buffer(byte *dest_strip, byte *src_strip, int src_width, - int left_offset, int left_width, int num_tiles, - int right_width) - { -@@ -908,7 +915,7 @@ gxht_thresh_planes(gx_image_enum *penum, fixed xrun, - to update with stride */ - position = contone_stride * k; - /* Tile into the 128 bit aligned threshold strip */ -- fill_threshhold_buffer(&(thresh_align[position]), -+ fill_threshold_buffer(&(thresh_align[position]), - thresh_tile, thresh_width, dx, left_width, - num_full_tiles, right_tile_width); - } -diff --git a/base/gxipixel.c b/base/gxipixel.c -index edd40c52d..cb4f02a09 100644 ---- a/base/gxipixel.c -+++ b/base/gxipixel.c -@@ -758,7 +758,7 @@ gx_image_enum_begin(gx_device * dev, const gs_gstate * pgs, - penum->memory = mem; - penum->buffer = buffer; - penum->buffer_size = bsize; -- penum->line = 0; -+ penum->line = NULL; - penum->icc_link = NULL; - penum->color_cache = NULL; - penum->ht_buffer = NULL; --- -2.17.0 -
  75. Download patch openjpeg/src/lib/openjp2/openjpeg.h
  76. Download patch openjpeg/src/lib/openjp2/opj_inttypes.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/opj_inttypes.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/opj_inttypes.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2012, Mathieu Malaterre <mathieu.malaterre@gmail.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef OPJ_INTTYPES_H +#define OPJ_INTTYPES_H + +#include "opj_config_private.h" +#ifdef OPJ_HAVE_INTTYPES_H +#include <inttypes.h> +#else +#if defined(_WIN32) +#define PRId64 "I64d" +#define PRIi64 "I64i" +#define PRIu64 "I64u" +#define PRIx64 "I64x" +#else +#error unsupported platform +#endif +#endif + +#endif /* OPJ_INTTYPES_H */
  77. Download patch openjpeg/src/lib/openjp2/cidx_manager.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/cidx_manager.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/cidx_manager.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * $Id: cidx_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $ + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2003-2004, Yannick Verschueren + * Copyright (c) 2010-2011, Kaori Hagihara + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*! \file + * \brief Modification of jpip.h from 2KAN indexer + */ + + +#ifndef CIDX_MANAGER_H_ +# define CIDX_MANAGER_H_ + +#include "openjpeg.h" + + +/* + * Write Codestream index box (superbox) + * + * @param[in] offset offset of j2k codestream + * @param[in] cio file output handle + * @param[in] image image data + * @param[in] cstr_info codestream information + * @param[in] j2klen length of j2k codestream + * @return length of cidx box + */ +int opj_write_cidx(int offset, opj_stream_private_t *cio, + opj_codestream_info_t cstr_info, int j2klen, + opj_event_mgr_t * p_manager); + +/* + * Check if EPH option is used + * + * @param[in] coff offset of j2k codestream + * @param[in] markers marker information + * @param[in] marknum number of markers + * @param[in] cio file output handle + * @return true if EPH is used + */ +OPJ_BOOL opj_check_EPHuse(int coff, opj_marker_info_t *markers, int marknum, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); + +#endif /* !CIDX_MANAGER_H_ */
  78. Download patch openjpeg/src/lib/openjp2/mqc_inl.h

    --- 9.22~dfsg-2.1/openjpeg/src/lib/openjp2/mqc_inl.h 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/openjpeg/src/lib/openjp2/mqc_inl.h 2018-02-23 19:09:54.000000000 +0000 @@ -0,0 +1,196 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2003-2007, Francois-Olivier Devaux + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPJ_MQC_INL_H +#define OPJ_MQC_INL_H + +/* For internal use of opj_mqc_decode_macro() */ +#define opj_mqc_mpsexchange_macro(d, curctx, a) \ +{ \ + if (a < (*curctx)->qeval) { \ + d = !((*curctx)->mps); \ + *curctx = (*curctx)->nlps; \ + } else { \ + d = (*curctx)->mps; \ + *curctx = (*curctx)->nmps; \ + } \ +} + +/* For internal use of opj_mqc_decode_macro() */ +#define opj_mqc_lpsexchange_macro(d, curctx, a) \ +{ \ + if (a < (*curctx)->qeval) { \ + a = (*curctx)->qeval; \ + d = (*curctx)->mps; \ + *curctx = (*curctx)->nmps; \ + } else { \ + a = (*curctx)->qeval; \ + d = !((*curctx)->mps); \ + *curctx = (*curctx)->nlps; \ + } \ +} + + +/** +Decode a symbol using raw-decoder. Cfr p.506 TAUBMAN +@param mqc MQC handle +@return Returns the decoded symbol (0 or 1) +*/ +static INLINE OPJ_UINT32 opj_mqc_raw_decode(opj_mqc_t *mqc) +{ + OPJ_UINT32 d; + if (mqc->ct == 0) { + /* Given opj_mqc_raw_init_dec() we know that at some point we will */ + /* have a 0xFF 0xFF artificial marker */ + if (mqc->c == 0xff) { + if (*mqc->bp > 0x8f) { + mqc->c = 0xff; + mqc->ct = 8; + } else { + mqc->c = *mqc->bp; + mqc->bp ++; + mqc->ct = 7; + } + } else { + mqc->c = *mqc->bp; + mqc->bp ++; + mqc->ct = 8; + } + } + mqc->ct--; + d = ((OPJ_UINT32)mqc->c >> mqc->ct) & 0x01U; + + return d; +} + + +#define opj_mqc_bytein_macro(mqc, c, ct) \ +{ \ + OPJ_UINT32 l_c; \ + /* Given opj_mqc_init_dec() we know that at some point we will */ \ + /* have a 0xFF 0xFF artificial marker */ \ + l_c = *(mqc->bp + 1); \ + if (*mqc->bp == 0xff) { \ + if (l_c > 0x8f) { \ + c += 0xff00; \ + ct = 8; \ + mqc->end_of_byte_stream_counter ++; \ + } else { \ + mqc->bp++; \ + c += l_c << 9; \ + ct = 7; \ + } \ + } else { \ + mqc->bp++; \ + c += l_c << 8; \ + ct = 8; \ + } \ +} + +/* For internal use of opj_mqc_decode_macro() */ +#define opj_mqc_renormd_macro(mqc, a, c, ct) \ +{ \ + do { \ + if (ct == 0) { \ + opj_mqc_bytein_macro(mqc, c, ct); \ + } \ + a <<= 1; \ + c <<= 1; \ + ct--; \ + } while (a < 0x8000); \ +} + +#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \ +{ \ + /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \ + /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \ + /* software-conventions decoder" has been tried, but does not bring any */ \ + /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \ + a -= (*curctx)->qeval; \ + if ((c >> 16) < (*curctx)->qeval) { \ + opj_mqc_lpsexchange_macro(d, curctx, a); \ + opj_mqc_renormd_macro(mqc, a, c, ct); \ + } else { \ + c -= (*curctx)->qeval << 16; \ + if ((a & 0x8000) == 0) { \ + opj_mqc_mpsexchange_macro(d, curctx, a); \ + opj_mqc_renormd_macro(mqc, a, c, ct); \ + } else { \ + d = (*curctx)->mps; \ + } \ + } \ +} + +#define DOWNLOAD_MQC_VARIABLES(mqc, curctx, c, a, ct) \ + register opj_mqc_state_t **curctx = mqc->curctx; \ + register OPJ_UINT32 c = mqc->c; \ + register OPJ_UINT32 a = mqc->a; \ + register OPJ_UINT32 ct = mqc->ct + +#define UPLOAD_MQC_VARIABLES(mqc, curctx, c, a, ct) \ + mqc->curctx = curctx; \ + mqc->c = c; \ + mqc->a = a; \ + mqc->ct = ct; + +/** +Input a byte +@param mqc MQC handle +*/ +static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) +{ + opj_mqc_bytein_macro(mqc, mqc->c, mqc->ct); +} + +/** +Renormalize mqc->a and mqc->c while decoding +@param mqc MQC handle +*/ +#define opj_mqc_renormd(mqc) \ + opj_mqc_renormd_macro(mqc, mqc->a, mqc->c, mqc->ct) + +/** +Decode a symbol +@param d OPJ_UINT32 value where to store the decoded symbol +@param mqc MQC handle +@return Returns the decoded symbol (0 or 1) in d +*/ +#define opj_mqc_decode(d, mqc) \ + opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct) + +#endif /* OPJ_MQC_INL_H */
  79. Download patch openjpeg/src/lib/openjp2/dwt.c
  80. Download patch debian/patches/CVE-2016-10317.patch

    --- 9.22~dfsg-2.1/debian/patches/CVE-2016-10317.patch 1970-01-01 00:00:00.000000000 +0000 +++ 9.22~dfsg+1-0ubuntu1.1/debian/patches/CVE-2016-10317.patch 2018-04-24 17:34:23.000000000 +0000 @@ -0,0 +1,75 @@ +From 362ec9daadb9992b0def3520cd1dc6fa52edd1c4 Mon Sep 17 00:00:00 2001 +From: Ray Johnston <ray.johnston@artifex.com> +Date: Tue, 21 Nov 2017 12:48:54 -0800 +Subject: [PATCH] Fix bug 697459 Buffer overflow in fill_threshold_buffer + +There was an overflow check for ht_buffer size, but none for the larger +threshold_buffer. Note that this file didn't fail on Windows because the +combination of the ht_buffer and the size of the (miscalculated due to +overflow) threshold_buffer would have exceeded the 2Gb limit. +--- + base/gxht_thresh.c | 13 ++++++++++--- + base/gxipixel.c | 2 +- + 2 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/base/gxht_thresh.c b/base/gxht_thresh.c +index 3fb8402..7268616 100644 +--- a/base/gxht_thresh.c ++++ b/base/gxht_thresh.c +@@ -711,7 +711,9 @@ gxht_thresh_image_init(gx_image_enum *penum) + space */ + max_height = (int) ceil(fixed2float(any_abs(penum->dst_height)) / + (float) penum->Height); +- if ((max_height > 0) && (penum->ht_stride * spp_out > max_int / max_height)) ++ if (max_height <= 0) ++ return -1; /* shouldn't happen, but check so we don't div by zero */ ++ if (penum->ht_stride * spp_out > max_int / max_height) + return -1; /* overflow */ + + penum->ht_buffer = +@@ -734,6 +736,11 @@ gxht_thresh_image_init(gx_image_enum *penum) + Also allow a 15 sample over run during the execution. */ + temp = (int) ceil((float) ((dev_width + 15.0) + 15.0)/16.0); + penum->line_size = bitmap_raster(temp * 16 * 8); /* The stride */ ++ if (penum->line_size > max_int / max_height) { ++ gs_free_object(penum->memory, penum->ht_buffer, "gxht_thresh"); ++ penum->ht_buffer = NULL; ++ return -1; /* thresh_buffer size overflow */ ++ } + penum->line = gs_alloc_bytes(penum->memory, penum->line_size * spp_out, + "gxht_thresh"); + penum->thresh_buffer = gs_alloc_bytes(penum->memory, +@@ -754,7 +761,7 @@ gxht_thresh_image_init(gx_image_enum *penum) + } + + static void +-fill_threshhold_buffer(byte *dest_strip, byte *src_strip, int src_width, ++fill_threshold_buffer(byte *dest_strip, byte *src_strip, int src_width, + int left_offset, int left_width, int num_tiles, + int right_width) + { +@@ -908,7 +915,7 @@ gxht_thresh_planes(gx_image_enum *penum, fixed xrun, + to update with stride */ + position = contone_stride * k; + /* Tile into the 128 bit aligned threshold strip */ +- fill_threshhold_buffer(&(thresh_align[position]), ++ fill_threshold_buffer(&(thresh_align[position]), + thresh_tile, thresh_width, dx, left_width, + num_full_tiles, right_tile_width); + } +diff --git a/base/gxipixel.c b/base/gxipixel.c +index edd40c5..cb4f02a 100644 +--- a/base/gxipixel.c ++++ b/base/gxipixel.c +@@ -758,7 +758,7 @@ gx_image_enum_begin(gx_device * dev, const gs_gstate * pgs, + penum->memory = mem; + penum->buffer = buffer; + penum->buffer_size = bsize; +- penum->line = 0; ++ penum->line = NULL; + penum->icc_link = NULL; + penum->color_cache = NULL; + penum->ht_buffer = NULL; +-- +2.9.1 +
  1. ghostscript