Merge branch 'pr1095'
authorEven Rouault <even.rouault@spatialys.com>
Sat, 22 Sep 2018 21:12:50 +0000 (23:12 +0200)
committerEven Rouault <even.rouault@spatialys.com>
Sat, 22 Sep 2018 21:12:50 +0000 (23:12 +0200)
30 files changed:
.travis.yml
CHANGELOG.md
INSTALL.md
cmake/OpenJPEGConfig.cmake.in
src/bin/jp2/convert.c
src/bin/jp2/opj_compress.c
src/bin/jp2/opj_decompress.c
src/bin/jp3d/convert.c
src/bin/mj2/meta_out.c
src/bin/mj2/opj_mj2_compress.c
src/bin/mj2/opj_mj2_extract.c
src/lib/openjp2/dwt.c
src/lib/openjp2/j2k.c
src/lib/openjp2/jp2.c
src/lib/openjp2/openjpeg.h
src/lib/openjp2/opj_intmath.h
src/lib/openjpip/sock_manager.c
src/lib/openmj2/mj2.c
src/lib/openmj2/tcd.h
tests/nonregression/md5refs.txt
tests/nonregression/test_suite.ctest.in
thirdparty/README.txt
tools/travis-ci/install.sh
tools/travis-ci/knownfailures-Ubuntu12.04-clang3.9.0-x86_64-Debug-3rdP.txt [deleted file]
tools/travis-ci/knownfailures-Ubuntu12.04-clang3.9.0-x86_64-Release-3rdP.txt [deleted file]
tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.3-i386-Release-3rdP.txt [deleted file]
tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.4-i386-Release-3rdP.txt [deleted file]
tools/travis-ci/knownfailures-Ubuntu14.04-gcc4.8.4-i386-Release-3rdP.txt
tools/travis-ci/knownfailures-Ubuntu14.04-gcc4.8.4-x86_64-Debug-3rdP.txt [new file with mode: 0644]
tools/travis-ci/knownfailures-windows-vs2010-x86-Release-3rdP.txt

index 84aeb63e2889d584b376fa0a1534404351bdfff5..769a35350ac42519bb2851669ecae58cf0e31177 100644 (file)
@@ -51,6 +51,7 @@ matrix:
     - os: linux
       compiler: g++
       env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
+      dist: trusty
       addons:
         apt:
           packages:
@@ -61,6 +62,7 @@ matrix:
     - os: linux
       compiler: g++
       env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_PROFILE=1
+      dist: trusty
       addons:
         apt:
           packages:
@@ -76,6 +78,7 @@ matrix:
     - 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
+      dist: trusty
       addons:
         apt:
           sources:
@@ -88,6 +91,7 @@ matrix:
     - 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
+      dist: trusty
       addons:
         apt:
           packages:
@@ -103,6 +107,7 @@ matrix:
     - 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
+      dist: trusty
       addons:
         apt:
           packages:
index a01ca6d99044295d9b3f71252ab68baa0eb506e4..c24cf1ed66c7c3a41ea2d5600e8bda11da24a1f4 100644 (file)
 - Migration guide v2 [\#160](https://github.com/uclouvain/openjpeg/issues/160)
 - Cannot decompress JPEG2000Aware3.18.7.3Win32\_kdutranscode6.3.1.j2k [\#158](https://github.com/uclouvain/openjpeg/issues/158)
 - Cannot decompress JPEG2000Aware3.18.7.3Win32.j2k [\#157](https://github.com/uclouvain/openjpeg/issues/157)
-- openjpeg@googlegroups.com has disappeard [\#153](https://github.com/uclouvain/openjpeg/issues/153)
+- openjpeg@googlegroups.com has disappeared [\#153](https://github.com/uclouvain/openjpeg/issues/153)
 - OpenJPEG 1.5.0 crashes on a ridiculously big file... [\#151](https://github.com/uclouvain/openjpeg/issues/151)
 - opj\_image vs free [\#146](https://github.com/uclouvain/openjpeg/issues/146)
 - Windows .dll file invalid [\#140](https://github.com/uclouvain/openjpeg/issues/140)
 - Support unscaled 10 bit data for 2K cinema @ 48 FPS, as per DCI standard [\#671](https://github.com/uclouvain/openjpeg/issues/671)
 - Use parallel jobs in ctest [\#664](https://github.com/uclouvain/openjpeg/issues/664)
 - \[Security\]Multiple Memory error [\#663](https://github.com/uclouvain/openjpeg/issues/663)
-- lossy encoding a 16 bit TIF file : severe artifiacts in decompressed image [\#660](https://github.com/uclouvain/openjpeg/issues/660)
+- lossy encoding a 16 bit TIF file : severe artifacts in decompressed image [\#660](https://github.com/uclouvain/openjpeg/issues/660)
 - opj\_compress and opj\_decompress : get\_next\_file method uses hard-coded unix path separator [\#630](https://github.com/uclouvain/openjpeg/issues/630)
 - Uninitialized variable [\#629](https://github.com/uclouvain/openjpeg/issues/629)
 - Use of enum variable for bit flags prevents compilation as C++ source [\#619](https://github.com/uclouvain/openjpeg/issues/619)
 - Correct abi-check.sh for PR [\#791](https://github.com/uclouvain/openjpeg/pull/791) ([mayeut](https://github.com/mayeut))
 - Update tcd.c [\#790](https://github.com/uclouvain/openjpeg/pull/790) ([maddin200](https://github.com/maddin200))
 - Update lcms2 [\#773](https://github.com/uclouvain/openjpeg/pull/773) ([mayeut](https://github.com/mayeut))
-- Use lowercase for cmake commands consistenly [\#769](https://github.com/uclouvain/openjpeg/pull/769) ([julienmalik](https://github.com/julienmalik))
+- Use lowercase for cmake commands consistently [\#769](https://github.com/uclouvain/openjpeg/pull/769) ([julienmalik](https://github.com/julienmalik))
 - Ignore clang's summary warning [\#768](https://github.com/uclouvain/openjpeg/pull/768) ([julienmalik](https://github.com/julienmalik))
 - Fix UBSan gcc warning for first arg to memset non null [\#767](https://github.com/uclouvain/openjpeg/pull/767) ([julienmalik](https://github.com/julienmalik))
 - Update to libtiff-4.0.6 [\#764](https://github.com/uclouvain/openjpeg/pull/764) ([mayeut](https://github.com/mayeut))
index a93140405575b825134065a3a8e6912b5b9c289e..1c0f1e4ed99034923a16aaa1048c1a4c6a2495de 100644 (file)
@@ -30,6 +30,7 @@ Main available cmake flags:
   * To specify the install path: '-DCMAKE\_INSTALL\_PREFIX=/path'
   * To build the shared libraries and links the executables against it: '-DBUILD\_SHARED\_LIBS:bool=on' (default: 'ON')
 > Note: when using this option, static libraries are not built and executables are dynamically linked.
+  * PKG_CONFIG files are by default built for Unix compile, you can force to build on other platforms by adding: '-DBUILD_PKGCONFIG_FILES=on'
   * To build the CODEC executables: '-DBUILD\_CODEC:bool=on' (default: 'ON')
   * To build opjstyle (internal version of astyle) for OpenJPEG development: '-DWITH_ASTYLE=ON'
   * [OBSOLETE] To build the MJ2 executables: '-DBUILD\_MJ2:bool=on' (default: 'OFF')
index b20294ca5afd3559d83d11b762c37e8112f132e6..2925108ad49e8eb4583d5d24f5e655c0c10a47a9 100644 (file)
@@ -26,8 +26,13 @@ get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
 if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
   # This is an install tree
   include(${SELF_DIR}/OpenJPEGTargets.cmake)
-  get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
-  set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
+
+  # We find a relative path from the PKG directory to header files.
+  set(PKG_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_PACKAGE_DIR@")
+  set(INC_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_INCLUDE_DIR@")
+  file(RELATIVE_PATH PKG_TO_INC_RPATH "${PKG_DIR}" "${INC_DIR}")
+
+  get_filename_component(OPENJPEG_INCLUDE_DIRS "${SELF_DIR}/${PKG_TO_INC_RPATH}" ABSOLUTE)
 
 else()
   if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
index 26af53f241bc3ef598fb73fb31a0baef5ede6300..fa02e31c5a458a7d1a7e41b231756bc82d20ad0e 100644 (file)
@@ -1812,6 +1812,13 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters)
         return NULL;
     }
 
+    if (header_info.width == 0
+            || header_info.height == 0
+            || (header_info.format == 7 && header_info.depth == 0)) {
+        fclose(fp);
+        return NULL;
+    }
+
     /* This limitation could be removed by making sure to use size_t below */
     if (header_info.height != 0 &&
             header_info.width > INT_MAX / header_info.height) {
@@ -1897,8 +1904,10 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters)
             for (compno = 0; compno < numcomps; compno++) {
                 index = 0;
                 if (fscanf(fp, "%u", &index) != 1) {
-                    fprintf(stderr,
-                            "\nWARNING: fscanf return a number of element different from the expected.\n");
+                    fprintf(stderr, "Missing data. Quitting.\n");
+                    opj_image_destroy(image);
+                    fclose(fp);
+                    return NULL;
                 }
 
                 image->comps[compno].data[i] = (OPJ_INT32)(index * 255) / header_info.maxval;
@@ -1916,8 +1925,7 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters)
         for (i = 0; i < w * h; i++) {
             for (compno = 0; compno < numcomps; compno++) {
                 if (!fread(&c0, 1, 1, fp)) {
-                    fprintf(stderr,
-                            "\nError: fread return a number of element different from the expected.\n");
+                    fprintf(stderr, "Missing data. Quitting.\n");
                     opj_image_destroy(image);
                     fclose(fp);
                     return NULL;
@@ -1926,8 +1934,10 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters)
                     image->comps[compno].data[i] = c0;
                 } else {
                     if (!fread(&c1, 1, 1, fp)) {
-                        fprintf(stderr,
-                                "\nError: fread return a number of element different from the expected.\n");
+                        fprintf(stderr, "Missing data. Quitting.\n");
+                        opj_image_destroy(image);
+                        fclose(fp);
+                        return NULL;
                     }
                     /* netpbm: */
                     image->comps[compno].data[i] = ((c0 << 8) | c1);
@@ -1939,15 +1949,17 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters)
             unsigned int index;
 
             if (fscanf(fp, "%u", &index) != 1) {
-                fprintf(stderr,
-                        "\nWARNING: fscanf return a number of element different from the expected.\n");
+                fprintf(stderr, "Missing data. Quitting.\n");
+                opj_image_destroy(image);
+                fclose(fp);
+                return NULL;
             }
 
             image->comps[0].data[i] = (index ? 0 : 255);
         }
     } else if (format == 4) {
         int x, y, bit;
-        unsigned char uc;
+        int uc;
 
         i = 0;
         for (y = 0; y < h; ++y) {
@@ -1957,9 +1969,15 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters)
             for (x = 0; x < w; ++x) {
                 if (bit == -1) {
                     bit = 7;
-                    uc = (unsigned char)getc(fp);
+                    uc = getc(fp);
+                    if (uc == EOF) {
+                        fprintf(stderr, "Missing data. Quitting.\n");
+                        opj_image_destroy(image);
+                        fclose(fp);
+                        return NULL;
+                    }
                 }
-                image->comps[0].data[i] = (((uc >> bit) & 1) ? 0 : 255);
+                image->comps[0].data[i] = ((((unsigned char)uc >> bit) & 1) ? 0 : 255);
                 --bit;
                 ++i;
             }
@@ -1969,8 +1987,10 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters)
 
         for (i = 0; i < w * h; ++i) {
             if (!fread(&uc, 1, 1, fp)) {
-                fprintf(stderr,
-                        "\nError: fread return a number of element different from the expected.\n");
+                fprintf(stderr, "Missing data. Quitting.\n");
+                opj_image_destroy(image);
+                fclose(fp);
+                return NULL;
             }
             image->comps[0].data[i] = (uc & 1) ? 0 : 255;
         }
index 26454d9e778150d7145be326993b89decf982319..3131a433429faa246346ece7c5545a19e476d20a 100644 (file)
@@ -203,9 +203,9 @@ static void encode_help_display(void)
     fprintf(stdout,
             "    to the highest resolution level and subsequent records to lower \n");
     fprintf(stdout,
-            "    resolution levels. The last specified record is right-shifted for each \n");
+            "    resolution levels. The last specified record is halved successively for each \n");
     fprintf(stdout, "    remaining lower resolution levels.\n");
-    fprintf(stdout, "    Default: 215x215 at each resolution.\n");
+    fprintf(stdout, "    Default: 2^15x2^15 at each resolution.\n");
     fprintf(stdout, "-t <tile width>,<tile height>\n");
     fprintf(stdout, "    Tile size.\n");
     fprintf(stdout,
index 088f3a29b5d6b69692a8be396b9c8409f0af9222..a28a194bb7c738d23bc121d2d4c79d33fe021d91 100644 (file)
@@ -134,7 +134,7 @@ typedef struct opj_decompress_params {
     /** Verbose mode */
     OPJ_BOOL m_verbose;
 
-    /** tile number ot the decoded tile*/
+    /** tile number of the decoded tile */
     OPJ_UINT32 tile_index;
     /** Nb of tile to decode */
     OPJ_UINT32 nb_tile_to_decode;
index 7d802445d64846b3530e0214b1373f80ce940bee..23fd70b04365ea0d2628b2e17b10b5e7f4fcf50b 100644 (file)
@@ -788,7 +788,7 @@ int volumetobin(opj_volume_t * volume, char *outfile)
 
     fclose(fdest);
 
-    sprintf(name, "%s.img", outfile);
+    snprintf(name, sizeof(name), "%s.img", outfile);
     fimgdest = fopen(name, "w");
     if (!fimgdest) {
         fprintf(stdout, "[ERROR] Failed to open %s for writing\n", name);
index 2c0e2737702588d3809780af7f6e0f048d296761..139b2704d246291e829793176285b912e979e45b 100644 (file)
@@ -846,7 +846,7 @@ void xml_write_mdia(FILE* file, FILE* xmlout, mj2_tk_t *track,
         }
         for (i = 0; i < 4; i++) {
             uint_to_chars(track->url[track->num_url].location[i], buf);
-            fprintf(xmlout,  "              <Location>%s</Location>\n");
+            fprintf(xmlout,  "              <Location>%s</Location>\n", buf);
         }
         fprintf(xmlout,
                 "            </DataEntryUrlBox>\n"); // table w. flags, URLs, URNs
@@ -868,7 +868,7 @@ void xml_write_mdia(FILE* file, FILE* xmlout, mj2_tk_t *track,
         fprintf(xmlout,  "              <Location>");
         for (i = 0; i < 4; i++) {
             uint_to_chars(track->urn[track->num_urn].location[i], buf);
-            fprintf(xmlout, "%s");
+            fprintf(xmlout, "%s", buf);
         }
         fprintf(xmlout,  "</Location>\n");
         fprintf(xmlout,  "            </DataEntryUrnBox>\n");
index 4baefe6704b2be9d284de8c666ac92facd6d7e44..c61b4c920a820ff6f521783352e501a0649cb8c2 100644 (file)
@@ -270,7 +270,7 @@ int main(int argc, char **argv)
 
     /*
         configure the event callbacks (not required)
-        setting of each callback is optionnal
+        setting of each callback is optional
     */
     memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
     event_mgr.error_handler = error_callback;
index fa67bf855989e9c2aa80d8bfe81a3dcdb5244d89..74fbedaf2ffe754b41373e09a8b80f97c902ad73 100644 (file)
@@ -82,15 +82,20 @@ int main(int argc, char *argv[])
     mj2_sample_t *sample;
     unsigned char* frame_codestream;
     FILE *file, *outfile;
-    char outfilename[50];
+    char outfilename[FILENAME_MAX];
     mj2_dparameters_t parameters;
 
     if (argc != 3) {
-        printf("Usage: %s mj2filename output_location\n", argv[0]);
+        printf("Usage: %s mj2filename output_prefix\n", argv[0]);
         printf("Example: %s foreman.mj2 output/foreman\n", argv[0]);
         return 1;
     }
 
+    if (strlen(argv[2]) + 11 > sizeof(outfilename)) {
+        fprintf(stderr, "filename %d too long\n", strlen(argv[2]) + 11);
+        return 1;
+    }
+
     file = fopen(argv[1], "rb");
 
     if (!file) {
index 5b98d2b3805714053486dece9dce8c31e50e03fa..203684d480ae486a2366c7c72e479b53a86de0c8 100644 (file)
@@ -974,7 +974,7 @@ static void opj_idwt53_v(const opj_dwt_t *dwt,
 #if (defined(__SSE2__) || defined(__AVX2__))
         if (len > 1 && nb_cols == PARALLEL_COLS_53) {
             /* Same as below general case, except that thanks to SSE2/AVX2 */
-            /* we can efficently process 8/16 columns in parallel */
+            /* we can efficiently process 8/16 columns in parallel */
             opj_idwt53_v_cas0_mcols_SSE2_OR_AVX2(dwt->mem, sn, len, tiledp_col, stride);
             return;
         }
@@ -1017,7 +1017,7 @@ static void opj_idwt53_v(const opj_dwt_t *dwt,
 #if (defined(__SSE2__) || defined(__AVX2__))
         if (len > 2 && nb_cols == PARALLEL_COLS_53) {
             /* Same as below general case, except that thanks to SSE2/AVX2 */
-            /* we can efficently process 8/16 columns in parallel */
+            /* we can efficiently process 8/16 columns in parallel */
             opj_idwt53_v_cas1_mcols_SSE2_OR_AVX2(dwt->mem, sn, len, tiledp_col, stride);
             return;
         }
@@ -2041,7 +2041,7 @@ static OPJ_BOOL opj_dwt_decode_partial_tile(
         tr_hl_x0 = (OPJ_UINT32)tr->bands[0].x0;
         tr_lh_y0 = (OPJ_UINT32)tr->bands[1].y0;
 
-        /* Substract the origin of the bands for this tile, to the subwindow */
+        /* Subtract the origin of the bands for this tile, to the subwindow */
         /* of interest band coordinates, so as to get them relative to the */
         /* tile */
         win_ll_x0 = opj_uint_subs(win_ll_x0, tr_ll_x0);
@@ -2759,7 +2759,7 @@ OPJ_BOOL opj_dwt_decode_partial_97(opj_tcd_tilecomp_t* OPJ_RESTRICT tilec,
         tr_hl_x0 = (OPJ_UINT32)tr->bands[0].x0;
         tr_lh_y0 = (OPJ_UINT32)tr->bands[1].y0;
 
-        /* Substract the origin of the bands for this tile, to the subwindow */
+        /* Subtract the origin of the bands for this tile, to the subwindow */
         /* of interest band coordinates, so as to get them relative to the */
         /* tile */
         win_ll_x0 = opj_uint_subs(win_ll_x0, tr_ll_x0);
index 6e9cf8ce0a330041a91ac6816cb69ee9a86bbc2e..4169cd672b78eae5a7ea9222b0288820ccbd9772 100644 (file)
@@ -1925,7 +1925,8 @@ static OPJ_BOOL opj_j2k_read_soc(opj_j2k_t *p_j2k,
     /* FIXME move it in a index structure included in p_j2k*/
     p_j2k->cstr_index->main_head_start = opj_stream_tell(p_stream) - 2;
 
-    opj_event_msg(p_manager, EVT_INFO, "Start to read j2k main header (%d).\n",
+    opj_event_msg(p_manager, EVT_INFO,
+                  "Start to read j2k main header (%" PRId64 ").\n",
                   p_j2k->cstr_index->main_head_start);
 
     /* Add the marker to the codestream index*/
@@ -4094,7 +4095,12 @@ static OPJ_BOOL opj_j2k_merge_ppt(opj_tcp_t *p_tcp, opj_event_mgr_t * p_manager)
     /* preconditions */
     assert(p_tcp != 00);
     assert(p_manager != 00);
-    assert(p_tcp->ppt_buffer == NULL);
+
+    if (p_tcp->ppt_buffer != NULL) {
+        opj_event_msg(p_manager, EVT_ERROR,
+                      "opj_j2k_merge_ppt() has already been called\n");
+        return OPJ_FALSE;
+    }
 
     if (p_tcp->ppt == 0U) {
         return OPJ_TRUE;
@@ -8845,7 +8851,10 @@ OPJ_BOOL opj_j2k_read_tile_header(opj_j2k_t * p_j2k,
 
     /* Current marker is the EOC marker ?*/
     if (l_current_marker == J2K_MS_EOC) {
-        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
+        if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
+            p_j2k->m_current_tile_number = 0;
+            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
+        }
     }
 
     /* FIXME DOC ???*/
index c79ea7316aff706d980f218779e073f72a287f74..f15f45ae7718dea4e20855e60bf86b6406a1b9c2 100644 (file)
@@ -1005,7 +1005,7 @@ static OPJ_BOOL opj_jp2_check_color(opj_image_t *image, opj_jp2_color_t *color,
                 if (!pcol_usage[i]) {
                     is_sane = 0U;
                     opj_event_msg(p_manager, EVT_WARNING,
-                                  "Component mapping seems wrong. Trying to correct.\n", i);
+                                  "Component mapping seems wrong. Trying to correct.\n");
                     break;
                 }
             }
index 6412e1b89131d037c274ef136f01a45b82e3e533..53a0e10c54b3312cd6722b57ad66b93f69905f67 100644 (file)
@@ -548,7 +548,7 @@ typedef struct opj_dparameters {
     /** Verbose mode */
     OPJ_BOOL m_verbose;
 
-    /** tile number ot the decoded tile*/
+    /** tile number of the decoded tile */
     OPJ_UINT32 tile_index;
     /** Nb of tile to decode */
     OPJ_UINT32 nb_tile_to_decode;
@@ -1385,7 +1385,7 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_decoded_components(opj_codec_t *p_codec,
  * performance improvements when reading an image by chunks.
  *
  * @param   p_codec         the jpeg2000 codec.
- * @param   p_image         the decoded image previously setted by opj_read_header
+ * @param   p_image         the decoded image previously set by opj_read_header
  * @param   p_start_x       the left position of the rectangle to decode (in image coordinates).
  * @param   p_end_x         the right position of the rectangle to decode (in image coordinates).
  * @param   p_start_y       the up position of the rectangle to decode (in image coordinates).
index ad13597661319d8eda186143e3fb7b2c0019bdd3..754b5512ff2cf64640359c21d23259076fab7159 100644 (file)
@@ -170,7 +170,7 @@ Divide an integer and round upwards
 static INLINE OPJ_UINT32  opj_uint_ceildiv(OPJ_UINT32  a, OPJ_UINT32  b)
 {
     assert(b);
-    return (a + b - 1) / b;
+    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
 }
 
 /**
index ec2455e8f6d943b6c297a4abdd9d961174211684..a776cedbb66fea90e824e1ac982bc833c1f4e1be 100644 (file)
@@ -30,7 +30,9 @@
 
 #ifdef _WIN32
 #include <windows.h>
+#ifdef _MSC_VER
 typedef SSIZE_T ssize_t;
+#endif
 #else
 #include <sys/types.h>
 #include <sys/socket.h>
index 01335fc66189332c5af4f8b2ca6d012d36114ea1..8e036f182db6bb7727e91e7800471a2fddee3b77 100644 (file)
@@ -534,7 +534,7 @@ void mj2_write_stsz(mj2_tk_t * tk, opj_cio_t *cio)
 
     else {
         cio_write(cio, 0,
-                  4);       /* Sample Size = 0 becase they all have different sizes */
+                  4);       /* Sample Size = 0 because they all have different sizes */
 
         cio_write(cio, tk->num_samples, 4); /* Sample Count */
 
index 83bf788ee98e1cd5bcd056f80925a502ed18e1b1..4a530014cb85ea5e447342f4dbf013c786fe1fc4 100644 (file)
@@ -114,7 +114,7 @@ typedef struct opj_tcd_precinct {
     int x0, y0, x1,
         y1;       /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */
     int cw, ch;           /* number of precinct in width and height */
-    union {       /* code-blocks informations */
+    union {       /* code-blocks information */
         opj_tcd_cblk_enc_t* enc;
         opj_tcd_cblk_dec_t* dec;
     } cblks;
index 903566d627b20b172c3b00068bca806deabefe11..a33e82a12802598a06ef2b39aafaad359e04e982 100644 (file)
@@ -316,4 +316,5 @@ ac8f6ab3acc9c692ed7c41bd62a0e1e8  file1.jp2-c0-r1.tif
 fbfcf662b6f7549574b2885490fbcf12  file1.jp2-c0-d10_20_30_40.tif
 fa7382fd8b2e788b28b807e200dd95b9  file1.jp2-c0-t0.tif
 ac8f6ab3acc9c692ed7c41bd62a0e1e8  file1.jp2-c0-t0-r1.tif
-f31bcb01c771f829054cdb013575e86a  issue1043.png
\ No newline at end of file
+f31bcb01c771f829054cdb013575e86a  issue1043.png
+62bc654c830efddf1b23d6e208447dab  tnsot_zero.png
index 9fe4bc0bb76887bedc6f82aed63084c5be9d0278..4048a410a318c9d786aab419467f209b631f395c 100644 (file)
@@ -625,3 +625,8 @@ opj_decompress -i @INPUT_CONF_PATH@/file1.jp2 -o @TEMP_PATH@/file1.jp2-c0-t0-r1.
 !opj_decompress -i @INPUT_CONF_PATH@/file1.jp2 -o @TEMP_PATH@/file1.jp2-c10.tif -c 10
 
 opj_decompress -i @INPUT_NR_PATH@/db11217111510058.jp2 -o @TEMP_PATH@/issue1043.png
+
+opj_decompress -i @INPUT_NR_PATH@/tnsot_zero.jp2 -o @TEMP_PATH@/tnsot_zero.png
+
+# try to decompress file with repeated PPT marker
+!opj_decompress -i @INPUT_NR_PATH@/oss-fuzz2785.jp2 -o @TEMP_PATH@/oss-fuzz2785.png
index e7a961c0f752f2e3696cbd094d1c0ff22666af47..85c95b55efeb3507b80ca138c1c60fc418f3e2ff 100644 (file)
@@ -5,5 +5,5 @@ They are solely provided for ease of build of OpenJPEG on system where those
 3rd party libs are not easily accessible (typically non-UNIX).
 
 The OpenJPEG does not recommend using those 3rd party libs over your system
-installed libs. The OpenJPEG does not even garantee that those libraries will
+installed libs. The OpenJPEG does not even guarantee that those libraries will
 work for you.
index 2664eb036087bc447516160a895a713923367e6d..3539b821ed2d74c64e28744f927b3f07cdb5fbba 100755 (executable)
@@ -89,7 +89,7 @@ if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
                        mv KDU77_Demo_Apps_for_Linux-x86-64_150710 kdu
                elif [ "${TRAVIS_OS_NAME:-}" == "osx" ] || uname -s | grep -i Darwin &> /dev/null; then
                        echo "Retrieving Kakadu"
-                       wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip
+                       wget -v http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip
                        cmake -E tar -xf KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip
                        wget -q http://downloads.sourceforge.net/project/catacombae/HFSExplorer/0.23/hfsexplorer-0.23-bin.zip
                        mkdir hfsexplorer && cmake -E chdir hfsexplorer tar -xf ../hfsexplorer-0.23-bin.zip
diff --git a/tools/travis-ci/knownfailures-Ubuntu12.04-clang3.9.0-x86_64-Debug-3rdP.txt b/tools/travis-ci/knownfailures-Ubuntu12.04-clang3.9.0-x86_64-Debug-3rdP.txt
deleted file mode 100644 (file)
index 2554d91..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-15-compare_dec-ref-out2base
-NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-16-compare_dec-ref-out2base
-NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-17-compare_dec-ref-out2base
-NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-18-compare_dec-ref-out2base
-NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-19-compare_dec-ref-out2base
-NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-20-compare_dec-ref-out2base
-NR-ENC-ElephantDream_4K.tif-21-compare_dec-ref-out2base
-NR-ENC-issue141.rawl-23-compare_dec-ref-out2base
diff --git a/tools/travis-ci/knownfailures-Ubuntu12.04-clang3.9.0-x86_64-Release-3rdP.txt b/tools/travis-ci/knownfailures-Ubuntu12.04-clang3.9.0-x86_64-Release-3rdP.txt
deleted file mode 100644 (file)
index 2554d91..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-15-compare_dec-ref-out2base
-NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-16-compare_dec-ref-out2base
-NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-17-compare_dec-ref-out2base
-NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-18-compare_dec-ref-out2base
-NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-19-compare_dec-ref-out2base
-NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-20-compare_dec-ref-out2base
-NR-ENC-ElephantDream_4K.tif-21-compare_dec-ref-out2base
-NR-ENC-issue141.rawl-23-compare_dec-ref-out2base
diff --git a/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.3-i386-Release-3rdP.txt b/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.3-i386-Release-3rdP.txt
deleted file mode 100644 (file)
index 104a2af..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-NR-C1P0-p0_04.j2k-compare2base
-NR-C1P0-p0_05.j2k-compare2base
-NR-C1P0-p0_06.j2k-compare2base
-NR-C1P1-p1_02.j2k-compare2base
-NR-C1P1-p1_03.j2k-compare2base
-NR-C1P1-p1_04.j2k-compare2base
-NR-C1P1-p1_05.j2k-compare2base
-NR-JP2-file2.jp2-compare2base
-NR-JP2-file3.jp2-compare2base
-NR-RIC-subsampling_1.jp2-compare2base
-NR-RIC-subsampling_2.jp2-compare2base
-NR-RIC-zoo1.jp2-compare2base
-NR-RIC-zoo2.jp2-compare2base
-NR-DEC-_00042.j2k-2-decode-md5
-NR-DEC-buxI.j2k-9-decode-md5
-NR-DEC-CT_Phillips_JPEG2K_Decompr_Problem.j2k-13-decode-md5
-NR-DEC-Marrin.jp2-18-decode-md5
-NR-DEC-file409752.jp2-40-decode-md5
-NR-DEC-issue188_beach_64bitsbox.jp2-41-decode-md5
-NR-DEC-issue206_image-000.jp2-42-decode-md5
-NR-DEC-issue205.jp2-43-decode-md5
-NR-DEC-issue228.j2k-60-decode-md5
-NR-DEC-issue134.jp2-67-decode-md5
-NR-DEC-issue208.jp2-69-decode-md5
-NR-DEC-issue211.jp2-70-decode-md5
-NR-DEC-issue414.jp2-110-decode-md5
-NR-DEC-p1_04.j2k-124-decode-md5
-NR-DEC-p1_04.j2k-125-decode-md5
-NR-DEC-p1_04.j2k-126-decode-md5
-NR-DEC-p1_04.j2k-127-decode-md5
-NR-DEC-p1_04.j2k-128-decode-md5
-NR-DEC-p1_04.j2k-129-decode-md5
-NR-DEC-p1_04.j2k-131-decode-md5
-NR-DEC-p1_04.j2k-134-decode-md5
-NR-DEC-p1_04.j2k-138-decode-md5
-NR-DEC-p1_04.j2k-140-decode-md5
-NR-DEC-p0_04.j2k-166-decode-md5
-NR-DEC-p0_04.j2k-168-decode-md5
-NR-DEC-p0_04.j2k-172-decode-md5
-NR-DEC-issue205.jp2-253-decode-md5
-NR-DEC-issue236-ESYCC-CDEF.jp2-254-decode-md5
-NR-DEC-issue559-eci-090-CIELab.jp2-255-decode-md5
-NR-DEC-issue559-eci-091-CIELab.jp2-256-decode-md5
-NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
-NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
-NR-DEC-issue135.j2k-68-decode-md5
-NR-DEC-db11217111510058.jp2-306-decode-md5
diff --git a/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.4-i386-Release-3rdP.txt b/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.4-i386-Release-3rdP.txt
deleted file mode 100644 (file)
index 104a2af..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-NR-C1P0-p0_04.j2k-compare2base
-NR-C1P0-p0_05.j2k-compare2base
-NR-C1P0-p0_06.j2k-compare2base
-NR-C1P1-p1_02.j2k-compare2base
-NR-C1P1-p1_03.j2k-compare2base
-NR-C1P1-p1_04.j2k-compare2base
-NR-C1P1-p1_05.j2k-compare2base
-NR-JP2-file2.jp2-compare2base
-NR-JP2-file3.jp2-compare2base
-NR-RIC-subsampling_1.jp2-compare2base
-NR-RIC-subsampling_2.jp2-compare2base
-NR-RIC-zoo1.jp2-compare2base
-NR-RIC-zoo2.jp2-compare2base
-NR-DEC-_00042.j2k-2-decode-md5
-NR-DEC-buxI.j2k-9-decode-md5
-NR-DEC-CT_Phillips_JPEG2K_Decompr_Problem.j2k-13-decode-md5
-NR-DEC-Marrin.jp2-18-decode-md5
-NR-DEC-file409752.jp2-40-decode-md5
-NR-DEC-issue188_beach_64bitsbox.jp2-41-decode-md5
-NR-DEC-issue206_image-000.jp2-42-decode-md5
-NR-DEC-issue205.jp2-43-decode-md5
-NR-DEC-issue228.j2k-60-decode-md5
-NR-DEC-issue134.jp2-67-decode-md5
-NR-DEC-issue208.jp2-69-decode-md5
-NR-DEC-issue211.jp2-70-decode-md5
-NR-DEC-issue414.jp2-110-decode-md5
-NR-DEC-p1_04.j2k-124-decode-md5
-NR-DEC-p1_04.j2k-125-decode-md5
-NR-DEC-p1_04.j2k-126-decode-md5
-NR-DEC-p1_04.j2k-127-decode-md5
-NR-DEC-p1_04.j2k-128-decode-md5
-NR-DEC-p1_04.j2k-129-decode-md5
-NR-DEC-p1_04.j2k-131-decode-md5
-NR-DEC-p1_04.j2k-134-decode-md5
-NR-DEC-p1_04.j2k-138-decode-md5
-NR-DEC-p1_04.j2k-140-decode-md5
-NR-DEC-p0_04.j2k-166-decode-md5
-NR-DEC-p0_04.j2k-168-decode-md5
-NR-DEC-p0_04.j2k-172-decode-md5
-NR-DEC-issue205.jp2-253-decode-md5
-NR-DEC-issue236-ESYCC-CDEF.jp2-254-decode-md5
-NR-DEC-issue559-eci-090-CIELab.jp2-255-decode-md5
-NR-DEC-issue559-eci-091-CIELab.jp2-256-decode-md5
-NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
-NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
-NR-DEC-issue135.j2k-68-decode-md5
-NR-DEC-db11217111510058.jp2-306-decode-md5
index 104a2afc4c19b1d37daa0bf271458b96a1e600ab..9615008ae6773bca12453ad1729f5f7414d67176 100644 (file)
@@ -45,3 +45,12 @@ NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
 NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
 NR-DEC-issue135.j2k-68-decode-md5
 NR-DEC-db11217111510058.jp2-306-decode-md5
+NR-DEC-tnsot_zero.jp2-307-decode-md5
+NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-15-compare_dec-ref-out2base
+NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-16-compare_dec-ref-out2base
+NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-17-compare_dec-ref-out2base
+NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-18-compare_dec-ref-out2base
+NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-19-compare_dec-ref-out2base
+NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-20-compare_dec-ref-out2base
+NR-ENC-ElephantDream_4K.tif-21-compare_dec-ref-out2base
+NR-ENC-issue141.rawl-23-compare_dec-ref-out2base
diff --git a/tools/travis-ci/knownfailures-Ubuntu14.04-gcc4.8.4-x86_64-Debug-3rdP.txt b/tools/travis-ci/knownfailures-Ubuntu14.04-gcc4.8.4-x86_64-Debug-3rdP.txt
new file mode 100644 (file)
index 0000000..2554d91
--- /dev/null
@@ -0,0 +1,8 @@
+NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-15-compare_dec-ref-out2base
+NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-16-compare_dec-ref-out2base
+NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-17-compare_dec-ref-out2base
+NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-18-compare_dec-ref-out2base
+NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-19-compare_dec-ref-out2base
+NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-20-compare_dec-ref-out2base
+NR-ENC-ElephantDream_4K.tif-21-compare_dec-ref-out2base
+NR-ENC-issue141.rawl-23-compare_dec-ref-out2base
index 27235010651d8575202033374a04d9bf3930a930..7850163cdaa9253457456d8f771ba79197250d92 100644 (file)
@@ -43,3 +43,4 @@ NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
 NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
 NR-DEC-issue135.j2k-68-decode-md5
 NR-DEC-db11217111510058.jp2-306-decode-md5
+NR-DEC-tnsot_zero.jp2-307-decode-md5