Commit 6df81855 authored by Aurelien Jarno's avatar Aurelien Jarno Committed by Mathieu Malaterre

Import Debian changes 2.3.0-1~riscv64

openjpeg2 (2.3.0-1~riscv64) unreleased; urgency=medium

  * Disable java and apache2 support.

openjpeg2 (2.3.0-1) unstable; urgency=medium

  * New upstream release. Closes: #877758
  * Drop explicit -dbg package. Closes: #877676
  * Fix CVE-2017-14041. Closes: #874115
  * Fix CVE-2017-14151. Closes: #874430
  * Fix CVE-2017-14152. Closes: #874431
parents 3b082df3 a0777eb2
# Changelog
## [v2.2.0]("https://github.com/uclouvain/openjpeg/releases/v2.2.0" ) (2017-08-10)
## [v2.3.0](https://github.com/uclouvain/openjpeg/releases/v2.3.0) (2017-10-04)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.2.0...v2.3.0)
**Implemented enhancements:**
- Sub-tile decoding: only decode precincts and codeblocks that intersect the window specified in opj_set_decode_area() [\#990](https://github.com/uclouvain/openjpeg/pull/990) ([rouault](https://github.com/rouault))
- Sub-tile decoding: only apply IDWT on areas that participate to the window of interest [\#1001](https://github.com/uclouvain/openjpeg/pull/1001) ([rouault](https://github.com/rouault))
- Sub-tile decoding: memory use reduction and perf improvements [\#1010](https://github.com/uclouvain/openjpeg/pull/1010) ([rouault](https://github.com/rouault))
- Add capability to decode only a subset of all components of an image. [\#1022](https://github.com/uclouvain/openjpeg/pull/1022) ([rouault](https://github.com/rouault))
**Fixed bugs:**
- Setting x offset of decode region to -1 causes opj\_decompress to go into infinite loop [\#736](https://github.com/uclouvain/openjpeg/issues/736)
- Problem decoding multiple tiles with get\_decoded\_tile when cmap/pclr/cdef boxes are present in jp2 file [\#484](https://github.com/uclouvain/openjpeg/issues/484)
- set reduce\_factor\_may\_fail [\#474](https://github.com/uclouvain/openjpeg/issues/474)
- opj\_compress.exe, command line parser, infinite loop [\#469](https://github.com/uclouvain/openjpeg/issues/469)
- Various memory access issues found via fuzzing [\#448](https://github.com/uclouvain/openjpeg/issues/448)
- Multiple warnings when building OpenJPEG \(trunk\) [\#442](https://github.com/uclouvain/openjpeg/issues/442)
- Bulk fuzz-testing report [\#427](https://github.com/uclouvain/openjpeg/issues/427)
- remove all printf from openjpeg / use proper function pointer for logging [\#371](https://github.com/uclouvain/openjpeg/issues/371)
- minor changes, clean-up [\#349](https://github.com/uclouvain/openjpeg/issues/349)
- image-\>numcomps \> 4 [\#333](https://github.com/uclouvain/openjpeg/issues/333)
- Improve support for region of interest [\#39](https://github.com/uclouvain/openjpeg/issues/39)
- Public function to tell kernel type used \(5x3 vs 9x7\) [\#3](https://github.com/uclouvain/openjpeg/issues/3)
- elf binary in source package ? [\#1026](https://github.com/uclouvain/openjpeg/issues/1026)
- opj\_cio\_open [\#1025](https://github.com/uclouvain/openjpeg/issues/1025)
- Building with Visual Studio 2015 [\#1023](https://github.com/uclouvain/openjpeg/issues/1023)
- tcd.cpp\>:1617:33: error: assigning to 'OPJ\_INT32 \*' \(aka 'int \*'\) from incompatible type 'void \*' [\#1021](https://github.com/uclouvain/openjpeg/issues/1021)
- j2k.cpp \> comparison of address of 'p\_j2k-\>m\_cp.tcps\[0\].m\_data' not equal to a null pointer is always true [\#1020](https://github.com/uclouvain/openjpeg/issues/1020)
- Openjpeg 2.2.0 always build shared library even though -DBUILD\_SHARED\_LIBS:bool=off [\#1019](https://github.com/uclouvain/openjpeg/issues/1019)
- missing fclose [\#1018](https://github.com/uclouvain/openjpeg/issues/1018)
- Use opj\_image\_data\_free instead of opj\_free for image-\>comps\[\].data [\#1014](https://github.com/uclouvain/openjpeg/issues/1014)
- malloc poison on some compilers - cross compiling [\#1013](https://github.com/uclouvain/openjpeg/issues/1013)
- Add OPJ\_VERSION\_MAJOR, OPJ\_VERSION\_MINOR, OPJ\_VERSION\_MICRO macros in openjpeg.h [\#1011](https://github.com/uclouvain/openjpeg/issues/1011)
- Encode: do not perform rate control for single-tile lossless [\#1009](https://github.com/uclouvain/openjpeg/issues/1009)
- opj\_set\_decoded\_resolution\_factor\(\): bad interaction with opj\_set\_decode\_area\(\) and/or opj\_decode\(\) [\#1006](https://github.com/uclouvain/openjpeg/issues/1006)
- memory allocation failure with .pgx file [\#999](https://github.com/uclouvain/openjpeg/issues/999)
- Unable to fuzz with raw image as input [\#998](https://github.com/uclouvain/openjpeg/issues/998)
- stack-based buffer overflow write in pgxtoimage \(/convert.c\) [\#997](https://github.com/uclouvain/openjpeg/issues/997)
- freeze with a crafted bmp [\#996](https://github.com/uclouvain/openjpeg/issues/996)
- invalid memory write in tgatoimage \(convert.c\) [\#995](https://github.com/uclouvain/openjpeg/issues/995)
- static build on Windows fails [\#994](https://github.com/uclouvain/openjpeg/issues/994)
- another heap-based buffer overflow in opj\_t2\_encode\_packet \(t2.c\) [\#993](https://github.com/uclouvain/openjpeg/issues/993)
- heap-based buffer overflow in opj\_t2\_encode\_packet \(t2.c\) [\#992](https://github.com/uclouvain/openjpeg/issues/992)
- heap-based buffer overflow in opj\_write\_bytes\_LE \(cio.c\) \(unfixed \#985\) [\#991](https://github.com/uclouvain/openjpeg/issues/991)
- heap overflow in opj\_compress [\#988](https://github.com/uclouvain/openjpeg/issues/988)
- heap overflow in opj\_decompress [\#987](https://github.com/uclouvain/openjpeg/issues/987)
- heap-based buffer overflow in opj\_bio\_byteout \(bio.c\) [\#986](https://github.com/uclouvain/openjpeg/issues/986)
- heap-based buffer overflow in opj\_write\_bytes\_LE \(cio.c\) [\#985](https://github.com/uclouvain/openjpeg/issues/985)
- memory allocation failure in opj\_aligned\_alloc\_n \(opj\_malloc.c\) [\#983](https://github.com/uclouvain/openjpeg/issues/983)
- heap-base buffer overflow in opj\_mqc\_flush \(mqc.c\) [\#982](https://github.com/uclouvain/openjpeg/issues/982)
- Decode fails for JP2s with ICC profile [\#981](https://github.com/uclouvain/openjpeg/issues/981)
- Unit tests failing on Ubuntu 17.04 [\#916](https://github.com/uclouvain/openjpeg/issues/916)
- Encoder crashes on small images [\#901](https://github.com/uclouvain/openjpeg/issues/901)
- openjpeg-1.5.3 fails to compile [\#830](https://github.com/uclouvain/openjpeg/issues/830)
- opj\_compress crops image \(win\) or creates a jp2 which cannot be decompressed \(lin\) [\#716](https://github.com/uclouvain/openjpeg/issues/716)
- -d flag is silently ignored when decoding a single tile [\#693](https://github.com/uclouvain/openjpeg/issues/693)
- transition away from dev-utils [\#628](https://github.com/uclouvain/openjpeg/issues/628)
- update instructions to build with Visual Studio and 64-Bit Visual C++ Toolset. [\#1028](https://github.com/uclouvain/openjpeg/pull/1028) ([quangnh89](https://github.com/quangnh89))
- Add missing newline at end of file [\#1024](https://github.com/uclouvain/openjpeg/pull/1024) ([stweil](https://github.com/stweil))
- merge master into coverity\_scan to update coverity results [\#1008](https://github.com/uclouvain/openjpeg/pull/1008) ([detonin](https://github.com/detonin))
- Use more const qualifiers [\#984](https://github.com/uclouvain/openjpeg/pull/984) ([stweil](https://github.com/stweil))
- Changes in converttif.c for PPC64 [\#980](https://github.com/uclouvain/openjpeg/pull/980) ([szukw000](https://github.com/szukw000))
## [v2.2.0](https://github.com/uclouvain/openjpeg/releases/v2.2.0) (2017-08-10)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.2...v2.2.0)
**Implemented enhancements:**
......
......@@ -32,7 +32,7 @@ include_regular_expression("^.*$")
#-----------------------------------------------------------------------------
# OPENJPEG version number, useful for packaging and doxygen doc:
set(OPENJPEG_VERSION_MAJOR 2)
set(OPENJPEG_VERSION_MINOR 2)
set(OPENJPEG_VERSION_MINOR 3)
set(OPENJPEG_VERSION_BUILD 0)
set(OPENJPEG_VERSION
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
......@@ -55,6 +55,7 @@ set(PACKAGE_VERSION
# 2.1.1 | 7
# 2.1.2 | 7
# 2.2.0 | 7
# 2.3.0 | 7
# above is the recommendation by the OPJ team. If you really need to override this default,
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
......@@ -173,6 +174,7 @@ configure_file(
#-----------------------------------------------------------------------------
# OpenJPEG build configuration options.
option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
option(BUILD_STATIC_LIBS "Build OpenJPEG static library." ON)
set (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
set (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
......@@ -253,7 +255,7 @@ if(BUILD_JPIP_SERVER)
endif()
add_subdirectory(src/lib)
option(BUILD_LUTS_GENERATOR "Build utility to generate t1_luts.h" OFF)
option(BUILD_BENCH_DWT "Build bench_dwt utility (development benchmark)" OFF)
option(BUILD_UNIT_TESTS "Build unit tests (bench_dwt, test_sparse_array, etc..)" OFF)
#-----------------------------------------------------------------------------
# Build Applications
......
......@@ -61,7 +61,35 @@ Note 4 : On MacOS, if it does not work, try adding the following flag to the cma
## MacOS (XCode) - WINDOWS (VisualStudio, etc)
You can use cmake to generate the project files for the IDE you are using (VC2010, XCode, etc).
Type 'cmake --help' for available generators on your platform.
Type `cmake --help` for available generators on your platform.
Examples for Windows with Visual Studio C++ compiler:
If using directly the cl compiler:
```
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
```
To compile a 64-bit application, open 64-Bit Visual C\+\+ toolset on the command line and run cmake. For further information, please refer to: [How to: Enable a 64-Bit Visual C\+\+ Toolset on the Command Line](https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx).
If you do not want directly use the cl compiler, you could use:
```
cmake -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
```
To create Visual Studio solution (.sln) and project files (.vcproj / .vcxproj):
```
cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
```
64-bit application:
```
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
```
# Enabling CPU specific optimizations
......@@ -74,21 +102,27 @@ CPUs)
With gcc/clang, it is possible to enable those instruction sets with the following :
```
cmake -DCMAKE_C_FLAGS="-O3 -msse4.1 -DNDEBUG" ..
```
```
cmake -DCMAKE_C_FLAGS="-O3 -mavx2 -DNDEBUG" ..
```
(AVX2 implies SSE4.1)
Or if the binary is dedicated to run on the machine where it has
been compiled :
```
cmake -DCMAKE_C_FLAGS="-O3 -march=native -DNDEBUG" ..
```
# Modifying OpenJPEG
Before committing changes, run:
scripts/prepare-commit.sh
```scripts/prepare-commit.sh```
# Using OpenJPEG
......
......@@ -2,7 +2,18 @@
More details in the [Changelog](https://github.com/uclouvain/openjpeg/blob/master/CHANGELOG.md)
## OpenJPEG 2.2.0
## OpenJPEG 2.3.0 (October 2017)
No API/ABI break compared to v2.2.0 but additional symbols for subset of components decoding (hence the MINOR version bump).
* Sub-tile decoding: when setting a window of interest through the API function opj_set_decode_area(), only codeblocks that intersect this window are now decoded (i.e. MCT, IDWT, and entropy decoding are only done on the window of interest). Moreover, memory allocation now depends on the size of the window of interest (instead of the full tile size).
[\#990](https://github.com/uclouvain/openjpeg/pull/990) [\#1001](https://github.com/uclouvain/openjpeg/pull/1001) [\#1010](https://github.com/uclouvain/openjpeg/pull/1010)
* Ability to decode only a subset of components. This adds the following function `opj_set_decoded_components(opj_codec_t p_codec, OPJ_UINT32 numcomps, const OPJ_UINT32 comps_indices, OPJ_BOOL apply_color_transforms)` and equivalent `opj_decompress -c compno[,compno]*`
option.
[\#1022](https://github.com/uclouvain/openjpeg/pull/1022)
* Many bug fixes (including security fixes)
## OpenJPEG 2.2.0 (August 2017)
No API/ABI break compared to v2.1.2 but additional symbols for multithreading support (hence the MINOR version bump).
......@@ -24,18 +35,18 @@ No API/ABI break compared to v2.1.2 but additional symbols for multithreading su
* 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
## OpenJPEG 2.1.2 (September 2016)
* Bug fixes (including security fixes)
* No API/ABI break compared to v2.1.1
## OpenJPEG 2.1.1
## OpenJPEG 2.1.1 (July 2016)
* Huge amount of critical bugfixes
* Speed improvements
* No API/ABI break compared to v2.1
## OpenJPEG 2.1.0
## OpenJPEG 2.1.0 (April 2014)
### New Features
......
version: 2.2.0.{build}
version: 2.3.0.{build}
branches:
except:
- coverity_scan
......
openjpeg2 (2.3.0-1~riscv64) unreleased; urgency=medium
* Disable java and apache2 support.
-- Aurelien Jarno <aurel32@debian.org> Fri, 16 Mar 2018 23:39:12 +0200
openjpeg2 (2.3.0-1) unstable; urgency=medium
* New upstream release. Closes: #877758
* Drop explicit -dbg package. Closes: #877676
* Fix CVE-2017-14041. Closes: #874115
* Fix CVE-2017-14151. Closes: #874430
* Fix CVE-2017-14152. Closes: #874431
-- Mathieu Malaterre <malat@debian.org> Mon, 16 Oct 2017 07:43:41 +0200
openjpeg2 (2.2.0-2) unstable; urgency=medium
* Fix changelog. Closes: #876535
......
......@@ -5,16 +5,12 @@ Uploaders: Mathieu Malaterre <malat@debian.org>
Homepage: http://www.openjpeg.org
Build-Depends: cmake (>= 2.8.2),
debhelper (>= 9),
default-jdk,
dh-apache2,
help2man,
javahelper (>= 0.37~),
libcurl4-gnutls-dev | libcurl-ssl-dev,
libfcgi-dev,
liblcms2-dev,
libpng-dev,
libtiff-dev,
libxerces2-java,
zlib1g-dev
Standards-Version: 4.1.0
Section: libs
......@@ -76,17 +72,6 @@ Description: JP3D (JPEG 2000 / Part 10) image compression/decompression library
.
This is an implementation of the JPEG 2000 (JP3D) volumetric imaging (Part-10)
Package: libopenjp2-7-dbg
Section: debug
Priority: extra
Architecture: any
Multi-Arch: same
Depends: libopenjp2-7 (= ${binary:Version}), ${misc:Depends}
Description: debug symbols for libopenjp2-7, a JPEG 2000 image library
This package contains the debug symbols to match the runtime component of the
OpenJPEG library, allowing debugging of a program using OpenJPEG to
access debugging details within the library itself.
Package: libopenjpip-dec-server
Section: graphics
Architecture: any
......@@ -98,49 +83,6 @@ Description: tool to allow caching of JPEG 2000 files using JPIP protocol
protocol. This command line application needs to run on the client side to
allow application such as opj_viewer to view images.
Package: libopenjpip-viewer
Section: graphics
Architecture: all
Depends: libopenjpip-dec-server, ${java:Depends}, ${misc:Depends}
Suggests: libopenjp2-tools
Conflicts: openjpip-viewer
Description: JPEG 2000 java based viewer for advanced remote JPIP access
Java based client to view remote JPEG 2000 using JPIP protocol.
This is a simple java viewer to allow:
.
- Scale up request: Enlarge the window
- ROI request: Select a region by mouse click and drag, then click inside the
red frame of the selected region
- Annotate image with ROI information in XML metadata: Click button "Region
Of Interest"
- Open a new window presenting an aligned image with a locally stored image:
Click button "Image Registration" (Under Construction)
Package: libopenjpip-server
Section: graphics
Architecture: any
Multi-Arch: foreign
Depends: libwww-perl,
spawn-fcgi (>= 1.6.1),
${misc:Depends},
${shlibs:Depends}
Recommends: ${misc:Recommends}
Conflicts: openjpip-server
Description: JPIP server for JPEG 2000 files
OpenJPIP software is an implementation of JPEG 2000 Part9: Interactivity tools,
APIs and protocols (JPIP). For more info about JPIP, check the website:
http://www.jpeg.org/jpeg2000/j2kpart9.html. The current implementation uses
some results from the 2KAN project (http://www.2kan.org).
.
First Version covers:
.
- JPT-stream (Tile based) and JPP-stream (Precinct based) media types
- Session, channels, cache model managements
- JPIP over HTTP
- Indexing JPEG 2000 files
- Embedding XML formatted metadata
- Region Of Interest (ROI) requests
Package: libopenjp3d-tools
Section: graphics
Architecture: any
......
......@@ -328,6 +328,7 @@ Files:
tools/travis-ci/knownfailures-windows-vs2010-x86-Release-3rdP.txt
tools/travis-ci/knownfailures-windows-vs2015-x64-Release-3rdP.txt
tools/travis-ci/knownfailures-windows-vs2015-x86-Release-3rdP.txt
tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.3-x86_64-Release-3rdP.txt
tools/travis-ci/run.sh
tools/travis-ci/travis_rsa.enc
Copyright: 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
......@@ -1092,6 +1093,10 @@ Files: tests/profiling/filter_massif_output.py
tests/fuzzers/GNUmakefile
src/lib/openjp2/opj_common.h
src/lib/openjp2/bench_dwt.c
src/lib/openjp2/sparse_array.c
src/lib/openjp2/sparse_array.h
src/lib/openjp2/test_sparse_array.c
tests/test_decode_area.c
Copyright: Copyright (c) 2017, IntoPIX SA
License: BSD-2
......
......@@ -25,6 +25,7 @@ libopenjp2.so.7 libopenjp2-7 #MINVER#
opj_read_tile_header@Base 2.0.0
opj_set_MCT@Base 2.0.0
opj_set_decode_area@Base 2.0.0
opj_set_decoded_components@Base 2.3.0
opj_set_decoded_resolution_factor@Base 2.0.0
opj_set_default_decoder_parameters@Base 2.0.0
opj_set_default_encoder_parameters@Base 2.0.0
......
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH OPJ_JP3D_COMPRESS "1" "September 2017" "opj_jp3d_compress 2.2.0" "User Commands"
.TH OPJ_JP3D_COMPRESS "1" "October 2017" "opj_jp3d_compress 2.3.0" "User Commands"
.SH NAME
opj_jp3d_compress \- Works with JPEG2000 files
.SH DESCRIPTION
......
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH OPJ_JP3D_DECOMPRESS "1" "September 2017" "opj_jp3d_decompress 2.2.0" "User Commands"
.TH OPJ_JP3D_DECOMPRESS "1" "October 2017" "opj_jp3d_decompress 2.3.0" "User Commands"
.SH NAME
opj_jp3d_decompress \- Works with JPEG2000 files
.SH DESCRIPTION
......
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH OPJ_JPIP_ADDXML "1" "September 2017" "opj_jpip_addxml 2.2.0" "User Commands"
.TH OPJ_JPIP_ADDXML "1" "October 2017" "opj_jpip_addxml 2.3.0" "User Commands"
.SH NAME
opj_jpip_addxml \- Works with JPEG2000 files
.SH DESCRIPTION
......
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH OPJ_JPIP_TEST "1" "September 2017" "opj_jpip_test 2.2.0" "User Commands"
.TH OPJ_JPIP_TEST "1" "October 2017" "opj_jpip_test 2.3.0" "User Commands"
.SH NAME
opj_jpip_test \- Works with JPEG2000 files
.SH DESCRIPTION
......
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH OPJ_JPIP_TRANSCODE "1" "September 2017" "opj_jpip_transcode 2.2.0" "User Commands"
.TH OPJ_JPIP_TRANSCODE "1" "October 2017" "opj_jpip_transcode 2.3.0" "User Commands"
.SH NAME
opj_jpip_transcode \- Works with JPEG2000 files
.SH DESCRIPTION
......
......@@ -7,7 +7,7 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_CFLAGS_MAINT_APPEND = -fvisibility=hidden
%:
dh $@ --parallel --with apache2,javahelper
dh $@ --parallel
CMAKE_EXTRA_FLAGS += -DCMAKE_SKIP_RPATH=ON \
-DCMAKE_BUILD_TYPE:STRING=None \
......@@ -30,7 +30,6 @@ override_dh_auto_configure:
SOVERSION=7
pkg_lib = libopenjp2-$(SOVERSION)
pkg_dev = libopenjp2-$(SOVERSION)-dev
pkg_dbg = libopenjp2-$(SOVERSION)-dbg
pkg_bin = libopenjp2-tools
pkg_lib3d = libopenjp3d$(SOVERSION)
pkg_bin3d = libopenjp3d-tools
......@@ -39,12 +38,9 @@ pkg_srv = libopenjpip-server
pkg_vwr = libopenjpip-viewer
pkg_dsrv = libopenjpip-dec-server
override_dh_strip:
dh_strip --dbg-package=$(pkg_dbg)
override_dh_install:
# annoying cmake-fatal-error export stuff:
sed -i -e "s/FATAL_ERROR/STATUS/g" debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/openjpeg-2.2/OpenJPEGTargets*.cmake
sed -i -e "s/FATAL_ERROR/STATUS/g" debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/openjpeg-2.3/OpenJPEGTargets*.cmake
# install opj_dump/compress/decompress:
dh_install -p$(pkg_bin) --autodest -Xjp3d -Xserver -Xjpip usr/bin/*
dh_install -p$(pkg_bin) --autodest -Xserver -Xjpip usr/share/man/man1/*.1
......@@ -52,19 +48,17 @@ override_dh_install:
dh_install -p$(pkg_lib) --autodest usr/lib/$(DEB_HOST_MULTIARCH)/libopenjp2.so.*
# dev:
dh_install -p$(pkg_dev) --autodest usr/lib/$(DEB_HOST_MULTIARCH)/libopenjp2.so
dh_install -p$(pkg_dev) --autodest usr/lib/$(DEB_HOST_MULTIARCH)/openjpeg-2.2/*.cmake
dh_install -p$(pkg_dev) --autodest usr/lib/$(DEB_HOST_MULTIARCH)/openjpeg-2.3/*.cmake
dh_install -p$(pkg_dev) --autodest usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/*.pc
dh_install -p$(pkg_dev) --autodest usr/include/openjpeg-2.2
# accept hardcoded path to 2.1 (2.2 kept the same SONAME):
dh_link -p$(pkg_dev) usr/lib/$(DEB_HOST_MULTIARCH)/openjpeg-2.2 usr/lib/$(DEB_HOST_MULTIARCH)/openjpeg-2.1
dh_link -p$(pkg_dev) usr/include/openjpeg-2.2 usr/include/openjpeg-2.1
dh_install -p$(pkg_dev) --autodest usr/include/openjpeg-2.3
# accept hardcoded path to 2.1 (2.3 kept the same SONAME):
dh_link -p$(pkg_dev) usr/lib/$(DEB_HOST_MULTIARCH)/openjpeg-2.3 usr/lib/$(DEB_HOST_MULTIARCH)/openjpeg-2.1
dh_link -p$(pkg_dev) usr/include/openjpeg-2.3 usr/include/openjpeg-2.1
# jp3d:
dh_install -p$(pkg_lib3d) --autodest usr/lib/$(DEB_HOST_MULTIARCH)/libopenjp3d.so.*
dh_install -p$(pkg_bin3d) --autodest usr/bin/opj_jp3d*
# libjpip:
dh_install -p$(pkg_jpip) --autodest usr/lib/$(DEB_HOST_MULTIARCH)/libopenjpip.so.*
# server:
dh_install -p$(pkg_srv) --autodest usr/bin/opj_server
# dec-server
dh_install -p$(pkg_dsrv) --autodest usr/bin/opj_dec_server
dh_install -p$(pkg_dsrv) --autodest usr/bin/opj_jpip*
......
......@@ -160,12 +160,15 @@ again:
}
if (argv[opj_optind][0] == '-') { /* long option */
char* arg = argv[opj_optind] + 1;
char* arg;
const opj_option_t* o;
o = longopts;
len = sizeof(longopts[0]);
if (param > 1) {
if (opj_optind + 1 >= argc) {
return -1;
}
arg = argv[opj_optind + 1];
opj_optind++;
} else {
......@@ -240,6 +243,7 @@ again:
'-') { /* Has read next input parameter: No arg for current parameter */
if (opj_opterr) {
fprintf(stderr, "%s: option requires an argument\n", arg);
++opj_optind;
return (BADCH);
}
}
......@@ -247,6 +251,7 @@ again:
if (!opj_optarg) { /* missing argument */
if (opj_opterr) {
fprintf(stderr, "%s: option requires an argument\n", arg);
++opj_optind;
return (BADCH);
}
}
......
......@@ -580,13 +580,10 @@ struct tga_header {
};
#endif /* INFORMATION_ONLY */
static unsigned short get_ushort(const unsigned char *data)
/* Returns a ushort from a little-endian serialized value */
static unsigned short get_tga_ushort(const unsigned char *data)
{
unsigned short val = *(const unsigned short *)data;
#ifdef OPJ_BIG_ENDIAN
val = ((val & 0xffU) << 8) | (val >> 8);
#endif
return val;
return (unsigned short)(data[0] | (data[1] << 8));
}
#define TGA_HEADER_SIZE 18
......@@ -613,17 +610,17 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
id_len = tga[0];
/*cmap_type = tga[1];*/
image_type = tga[2];
/*cmap_index = get_ushort(&tga[3]);*/
cmap_len = get_ushort(&tga[5]);
/*cmap_index = get_tga_ushort(&tga[3]);*/
cmap_len = get_tga_ushort(&tga[5]);
cmap_entry_size = tga[7];
#if 0
x_origin = get_ushort(&tga[8]);
y_origin = get_ushort(&tga[10]);
x_origin = get_tga_ushort(&tga[8]);
y_origin = get_tga_ushort(&tga[10]);
#endif
image_w = get_ushort(&tga[12]);
image_h = get_ushort(&tga[14]);
image_w = get_tga_ushort(&tga[12]);
image_h = get_tga_ushort(&tga[14]);
pixel_depth = tga[16];
image_desc = tga[17];
......@@ -817,6 +814,25 @@ opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters)
color_space = OPJ_CLRSPC_SRGB;
}
/* If the declared file size is > 10 MB, check that the file is big */
/* enough to avoid excessive memory allocations */
if (image_height != 0 &&
image_width > 10000000U / image_height / (OPJ_UINT32)numcomps) {
char ch;
OPJ_UINT64 expected_file_size =
(OPJ_UINT64)image_width * image_height * (OPJ_UINT32)numcomps;
long curpos = ftell(f);
if (expected_file_size > (OPJ_UINT64)INT_MAX) {
expected_file_size = (OPJ_UINT64)INT_MAX;
}
fseek(f, (long)expected_file_size - 1, SEEK_SET);
if (fread(&ch, 1, 1, f) != 1) {
fclose(f);
return NULL;
}
fseek(f, curpos, SEEK_SET);
}
subsampling_dx = parameters->subsampling_dx;
subsampling_dy = parameters->subsampling_dy;
......@@ -941,7 +957,7 @@ int imagetotga(opj_image_t * image, const char *outfile)
int width, height, bpp, x, y;
OPJ_BOOL write_alpha;
unsigned int i;
int adjustR, adjustG, adjustB, fails;
int adjustR, adjustG = 0, adjustB = 0, fails;
unsigned int alpha_channel;
float r, g, b, a;
unsigned char value;
......@@ -986,8 +1002,10 @@ int imagetotga(opj_image_t * image, const char *outfile)
scale = 255.0f / (float)((1 << image->comps[0].prec) - 1);
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
adjustB = (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
if (image->numcomps >= 3) {
adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
adjustB = (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
}
for (y = 0; y < height; y++) {
unsigned int index = (unsigned int)(y * width);
......@@ -1145,6 +1163,7 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)
opj_image_cmptparm_t cmptparm; /* maximum of 1 component */
opj_image_t * image = NULL;
int adjustS, ushift, dshift, force8;
OPJ_UINT64 expected_file_size;
char endian1, endian2, sign;
char signtmp[32];
......@@ -1167,7 +1186,7 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)
}
fseek(f, 0, SEEK_SET);
if (fscanf(f, "PG%[ \t]%c%c%[ \t+-]%d%[ \t]%d%[ \t]%d", temp, &endian1,
if (fscanf(f, "PG%31[ \t]%c%c%31[ \t+-]%d%31[ \t]%d%31[ \t]%d", temp, &endian1,
&endian2, signtmp, &prec, temp, &w, temp, &h) != 9) {
fclose(f);
fprintf(stderr,
......@@ -1195,6 +1214,29 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)
return NULL;
}
if (w < 1 || h < 1 || prec < 1 || prec > 31) {
fclose(f);
fprintf(stderr, "Bad pgx header, please check input file\n");
return NULL;
}
expected_file_size =
(OPJ_UINT64)w * (OPJ_UINT64)h * (prec > 16 ? 4 : prec > 8 ? 2 : 1);
if (expected_file_size > 10000000U) {
char ch;
long curpos = ftell(f);
if (expected_file_size > (OPJ_UINT64)INT_MAX) {
expected_file_size = (OPJ_UINT64)INT_MAX;
}
fseek(f, (long)expected_file_size - 1, SEEK_SET);
if (fread(&ch, 1, 1, f) != 1) {
fprintf(stderr, "File too short\n");
fclose(f);
return NULL;
}
fseek(f, curpos, SEEK_SET);
}
/* initialize image component */
cmptparm.x0 = (OPJ_UINT32)parameters->image_offset_x0;
......@@ -1290,7 +1332,7 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)
return image;
}
#define CLAMP(x,a,b) x < a ? a : (x > b ? b : x)
#define CLAMP(x,a,b) ((x) < (a) ? (a) : ((x) > (b) ? (b) : (x)))
static INLINE int clamp(const int value, const int prec, const int sgnd)
{
......@@ -1370,25 +1412,59 @@ int imagetopgx(opj_image_t * image, const char *outfile)
nbytes = 4;
}
for (i = 0; i < w * h; i++) {
/* FIXME: clamp func is being called within a loop */
const int val = clamp(image->comps[compno].data[i],
(int)comp->prec, (int)comp->sgnd);
for (j = nbytes - 1; j >= 0; j--) {
int v = (int)(val >> (j * 8));
unsigned char byte = (unsigned char)v;
res = fwrite(&byte, 1, 1, fdest);
if (res < 1) {
fprintf(stderr, "failed to write 1 byte for %s\n", name);
if (nbytes == 1) {
unsigned char* line_buffer = malloc((size_t)w);
if (line_buffer == NULL) {
fprintf(stderr, "Out of memory");
goto fin;
}
for (j = 0; j < h; j++) {
if (comp->prec == 8 && comp->sgnd == 0) {
for (i = 0; i < w; i++) {
line_buffer[i] = (unsigned char)CLAMP(image->comps[compno].data[j * w + i], 0,
255);
}
} else {
for (i = 0; i < w; i++) {
line_buffer[i] = (unsigned char)
clamp(image->comps[compno].data[j * w + i],
(int)comp->prec, (int)comp->sgnd);
}
}
res = fwrite(line_buffer, 1, (size_t)w, fdest);
if (res != (size_t)w) {
fprintf(stderr, "failed to write %d bytes for %s\n", w, name);
if (total > 256) {
free(name);
}
free(line_buffer);
goto fin;
}
}
free(line_buffer);
} else {
for (i = 0; i < w * h; i++) {
/* FIXME: clamp func is being called within a loop */
const int val = clamp(image->comps[compno].data[i],
(int)comp->prec, (int)comp->sgnd);
for (j = nbytes - 1; j >= 0; j--) {
int v = (int)(val >> (j * 8));
unsigned char byte = (unsigned char)v;
res = fwrite(&byte, 1, 1, fdest);
if (res < 1) {
fprintf(stderr, "failed to write 1 byte for %s\n", name);
if (total > 256) {
free(name);
}
goto fin;
}
}
}
}
if (total > 256) {
free(name);
}
......
......@@ -392,6 +392,10 @@ static OPJ_BOOL bmp_read_info_header(FILE* IN, OPJ_BITMAPINFOHEADER* header)
header->biBitCount = (OPJ_UINT16)getc(IN);
header->biBitCount |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
if (header->biBitCount == 0) {
fprintf(stderr, "Error, invalid biBitCount %d\n", 0);
return OPJ_FALSE;
}
if (header->biSize >= 40U) {
header->biCompression = (OPJ_UINT32)getc(IN);
......@@ -525,10 +529,19 @@ static OPJ_BOOL bmp_read_rle8_data(FILE* IN, OPJ_UINT8* pData,
x = y = 0U;
while (y < height) {
int c = getc(IN);
if (c == EOF) {
return OPJ_FALSE;
}
if (c) {
int j;
OPJ_UINT8 c1 = (OPJ_UINT8)getc(IN);
int j, c1_int;
OPJ_UINT8 c1;
c1_int = getc(IN);
if (c1_int == EOF) {
return OPJ_FALSE;
}
c1 = (OPJ_UINT8)c1_int;
for (j = 0; (j < c) && (x < width) &&