diff --git a/mingw-w64-openjpeg/PKGBUILD b/mingw-w64-openjpeg/PKGBUILD index ab3d97b8cb..2eac9eabdb 100644 --- a/mingw-w64-openjpeg/PKGBUILD +++ b/mingw-w64-openjpeg/PKGBUILD @@ -3,72 +3,74 @@ _realname=openjpeg _mingw_suff=mingw-w64-${CARCH} pkgname="${_mingw_suff}-${_realname}" -pkgver=1.5.1 -pkgrel=2 +pkgver=1.5.2 +pkgrel=1 pkgdesc="An open source JPEG 2000 codec (mingw-w64)" arch=('any') url="http://www.openjpeg.org" license=("BSD") -depends=("${_mingw_suff}-crt" "${_mingw_suff}-lcms2" "${_mingw_suff}-libtiff" "${_mingw_suff}-libpng" "${_mingw_suff}-zlib") -makedepends=("${_mingw_suff}-gcc" "${_mingw_suff}-pkg-config") +depends=("${_mingw_suff}-lcms2" "${_mingw_suff}-libtiff" "${_mingw_suff}-libpng" "${_mingw_suff}-zlib") +makedepends=("${_mingw_suff}-gcc" "${_mingw_suff}-cmake" "${_mingw_suff}-pkg-config") options=('staticlibs' 'strip') -source=("http://openjpeg.googlecode.com/files/openjpeg-${pkgver}.tar.gz" - "cdecl.patch" - "openjpeg-1.5.1_tiff-pkgconfig.patch" - "openjpeg-1.5-r2029.patch" - "openjpeg-1.5-r2031.patch" - "openjpeg-1.5-r2032.patch" - 'rhbz1036491_CVE-2013-6052.patch' - 'rhbz1036493_CVE-2013-6053.patch' - 'rhbz1036495_CVE-2013-6045.patch' - 'rhbz1037945_CVE-2013-1447.patch' - 'rhbz1037948_CVE-2013-6887.patch') - -md5sums=('b5f74cec2688fb918331bb014061be6f' +source=(http://sourceforge.net/projects/openjpeg.mirror/files/${_realname}-${pkgver}.tar.gz + "cdecl.patch" + "openjpeg-1.5.1_tiff-pkgconfig.patch" + mingw-install-pkgconfig-files.patch) + +md5sums=('c41772c30fb1c272358b3707233134a1' '673edf457f9b4f3fdc9a083e1857a76a' '7d4244a290c6f8d6777a7bd68706a7ef' - '3f7235e2e18f3a9953778d6e9d25cb81' - '4154f1f9fcc3c8a706d3741cda24295f' - 'e2dabc34959eacc5f8122aa521ece4e1' - '22b49c6689de2f4a5719681ff9854275' - '09f29dda2175f360dfc6e6e594a0d195' - '6224029ab05d5dc701878f5ad04f9ba9' - 'f091bff93751c58f9aee306a848fb961' - '5210916d5278a7391bc0e1d2f109f396') + '5f1a6d346dad00f919723dbc00546ae1') prepare() { - cd "$srcdir/openjpeg-$pkgver" - # Fix CRLF line endings - dos2unix libopenjpeg/opj_malloc.h - #rm -r thirdparty - patch -Np1 -i "$srcdir"/cdecl.patch - patch -Np1 -i "$srcdir"/openjpeg-1.5.1_tiff-pkgconfig.patch - patch -Np1 -i "$srcdir"/rhbz1036491_CVE-2013-6052.patch - patch -Np1 -i "$srcdir"/rhbz1036493_CVE-2013-6053.patch - patch -Np1 -i "$srcdir"/rhbz1036495_CVE-2013-6045.patch - patch -Np1 -i "$srcdir"/rhbz1037945_CVE-2013-1447.patch - patch -Np1 -i "$srcdir"/rhbz1037948_CVE-2013-6887.patch - patch -Np0 -i "$srcdir"/openjpeg-1.5-r2029.patch - patch -Np0 -i "$srcdir"/openjpeg-1.5-r2031.patch - patch -Np0 -i "$srcdir"/openjpeg-1.5-r2032.patch - - autoreconf -i + cd "$srcdir/openjpeg-$pkgver" + # Fix CRLF line endings + dos2unix libopenjpeg/opj_malloc.h + #rm -r thirdparty + patch -Np1 -i "$srcdir"/cdecl.patch + patch -Np1 -i "$srcdir"/openjpeg-1.5.1_tiff-pkgconfig.patch + patch -Np1 -i "$srcdir"/mingw-install-pkgconfig-files.patch + + #autoreconf -i } build() { - mkdir -p $srcdir/build-${MINGW_CHOST} && cd $srcdir/build-${MINGW_CHOST} - ../${_realname}-${pkgver}/configure \ - --prefix=${MINGW_PREFIX} \ - --build=${MINGW_CHOST} \ - --host=${MINGW_CHOST} \ - --disable-doc \ - --enable-jpwl - make + mkdir -p ${pkgdir}${MINGW_PREFIX} + pushd ${pkgdir}${MINGW_PREFIX} > /dev/null + export PREFIX_WIN=`pwd -W` + popd > /dev/null + + pushd ${MINGW_PREFIX} > /dev/null + export PREFIX_DEPS=`pwd -W` + popd > /dev/null + + [[ -d $srcdir/build-${MINGW_CHOST} ]] && rm -rf $srcdir/build-${MINGW_CHOST} + mkdir $srcdir/build-${MINGW_CHOST} + cd $srcdir/build-${MINGW_CHOST} + + ${MINGW_PREFIX}/bin/cmake \ + -G"MSYS Makefiles" \ + -DCMAKE_INSTALL_PREFIX=${PREFIX_WIN} \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING:BOOL=ON \ + -DCMAKE_SYSTEM_PREFIX_PATH=${PREFIX_DEPS} \ + -DOPENJPEG_INSTALL_SUBDIR="openjpeg/${ver}" \ + -DBUILD_MJ2=ON \ + -DBUILD_JPWL=ON \ + -DBUILD_JPIP=ON \ + ../${_realname}-$pkgver + make } package() { - cd "$srcdir/build-${MINGW_CHOST}" - make DESTDIR="$pkgdir" install - rm -r "${pkgdir}${MINGW_PREFIX}"/share - #rm "$pkgdir"/usr/${_arch}/bin/*.exe + cd "$srcdir/build-${MINGW_CHOST}" + make install # DESTDIR="$pkgdir" + + mkdir -p ${pkgdir}${MINGW_PREFIX} + pushd ${pkgdir}${MINGW_PREFIX} > /dev/null + export PREFIX_WIN=`pwd -W` + popd > /dev/null + sed -s "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" \ + -i ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/libopenjpeg.pc \ + -i ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/libopenjpeg1.pc } diff --git a/mingw-w64-openjpeg/mingw-install-pkgconfig-files.patch b/mingw-w64-openjpeg/mingw-install-pkgconfig-files.patch new file mode 100644 index 0000000000..49cdb9c7c4 --- /dev/null +++ b/mingw-w64-openjpeg/mingw-install-pkgconfig-files.patch @@ -0,0 +1,22 @@ +--- openjpeg-1.5.2/CMakeLists.txt.orig 2014-03-27 14:58:08.000000000 +0400 ++++ openjpeg-1.5.2/CMakeLists.txt 2014-04-16 21:38:07.250600000 +0400 +@@ -183,15 +183,15 @@ + + #----------------------------------------------------------------------------- + # pkgconfig support +-IF(UNIX) ++IF(UNIX OR MINGW) + # install in lib and not share (see multi-arch note above) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjpeg1.pc.cmake + ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc @ONLY) + INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc DESTINATION + ${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig ) +- INSTALL( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink +- \"libopenjpeg1.pc\" +- \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_SHARE_DIR}/pkgconfig/libopenjpeg.pc\")") ++ INSTALL( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ++ \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig/libopenjpeg1.pc\" ++ \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig/libopenjpeg.pc\")") + ENDIF(UNIX) + + #----------------------------------------------------------------------------- diff --git a/mingw-w64-openjpeg/openjpeg-1.5-r2029.patch b/mingw-w64-openjpeg/openjpeg-1.5-r2029.patch deleted file mode 100644 index a1a819a8c8..0000000000 --- a/mingw-w64-openjpeg/openjpeg-1.5-r2029.patch +++ /dev/null @@ -1,77 +0,0 @@ -Index: libopenjpeg/jp2.c -=================================================================== ---- libopenjpeg/jp2.c (revision 2028) -+++ libopenjpeg/jp2.c (revision 2029) -@@ -173,6 +173,10 @@ - else if (box->length == 0) { - box->length = cio_numbytesleft(cio) + 8; - } -+ if (box->length < 0) { -+ opj_event_msg(cinfo, EVT_ERROR, "Integer overflow in box->length\n"); -+ return OPJ_FALSE; // TODO: actually check jp2_read_boxhdr's return value -+ } - - return OPJ_TRUE; - } -@@ -654,6 +658,7 @@ - opj_event_msg(cinfo, EVT_ERROR, "Expected JP2H Marker\n"); - return OPJ_FALSE; - } -+ if (box.length <= 8) return OPJ_FALSE; - cio_skip(cio, box.length - 8); - - if(cio->bp >= cio->end) return OPJ_FALSE; -@@ -679,6 +684,7 @@ - { - if( !jp2_read_colr(jp2, cio, &box, color)) - { -+ if (box.length <= 8) return OPJ_FALSE; - cio_seek(cio, box.init_pos + 8); - cio_skip(cio, box.length - 8); - } -@@ -689,6 +695,7 @@ - { - if( !jp2_read_cdef(jp2, cio, &box, color)) - { -+ if (box.length <= 8) return OPJ_FALSE; - cio_seek(cio, box.init_pos + 8); - cio_skip(cio, box.length - 8); - } -@@ -699,6 +706,7 @@ - { - if( !jp2_read_pclr(jp2, cio, &box, color)) - { -+ if (box.length <= 8) return OPJ_FALSE; - cio_seek(cio, box.init_pos + 8); - cio_skip(cio, box.length - 8); - } -@@ -709,12 +717,14 @@ - { - if( !jp2_read_cmap(jp2, cio, &box, color)) - { -+ if (box.length <= 8) return OPJ_FALSE; - cio_seek(cio, box.init_pos + 8); - cio_skip(cio, box.length - 8); - } - if( jp2_read_boxhdr(cinfo, cio, &box) == OPJ_FALSE ) return OPJ_FALSE; - continue; - } -+ if (box.length <= 8) return OPJ_FALSE; - cio_seek(cio, box.init_pos + 8); - cio_skip(cio, box.length - 8); - if( jp2_read_boxhdr(cinfo, cio, &box) == OPJ_FALSE ) return OPJ_FALSE; -@@ -910,12 +920,14 @@ - } - do { - if(JP2_JP2C != box.type) { -+ if (box.length <= 8) return OPJ_FALSE; - cio_skip(cio, box.length - 8); - if( jp2_read_boxhdr(cinfo, cio, &box) == OPJ_FALSE ) return OPJ_FALSE; - } - } while(JP2_JP2C != box.type); - - *j2k_codestream_offset = cio_tell(cio); -+ if (box.length <= 8) return OPJ_FALSE; - *j2k_codestream_length = box.length - 8; - - return OPJ_TRUE; diff --git a/mingw-w64-openjpeg/openjpeg-1.5-r2031.patch b/mingw-w64-openjpeg/openjpeg-1.5-r2031.patch deleted file mode 100644 index d8249acad2..0000000000 --- a/mingw-w64-openjpeg/openjpeg-1.5-r2031.patch +++ /dev/null @@ -1,24 +0,0 @@ -Index: libopenjpeg/jpwl/Makefile.am -=================================================================== ---- libopenjpeg/jpwl/Makefile.am (revision 2030) -+++ libopenjpeg/jpwl/Makefile.am (revision 2031) -@@ -18,7 +18,6 @@ - ../pi.c \ - ../raw.c \ - ../t1.c \ --../t1_generate_luts.c \ - ../t2.c \ - ../tcd.c \ - ../tgt.c \ -Index: libopenjpeg/Makefile.am -=================================================================== ---- libopenjpeg/Makefile.am (revision 2030) -+++ libopenjpeg/Makefile.am (revision 2031) -@@ -35,7 +35,6 @@ - pi.c \ - raw.c \ - t1.c \ --t1_generate_luts.c \ - t2.c \ - tcd.c \ - tgt.c \ diff --git a/mingw-w64-openjpeg/openjpeg-1.5-r2032.patch b/mingw-w64-openjpeg/openjpeg-1.5-r2032.patch deleted file mode 100644 index 3d7d4fa7c3..0000000000 --- a/mingw-w64-openjpeg/openjpeg-1.5-r2032.patch +++ /dev/null @@ -1,30 +0,0 @@ -Index: libopenjpeg/j2k.c -=================================================================== ---- libopenjpeg/j2k.c (revision 2031) -+++ libopenjpeg/j2k.c (revision 2032) -@@ -468,6 +468,12 @@ - } - #endif /* USE_JPWL */ - -+ /* prevent division by zero */ -+ if (!(cp->tdx * cp->tdy)) { -+ opj_event_msg(j2k->cinfo, EVT_ERROR, "JPWL: invalid tile size (tdx: %d, tdy: %d)\n", cp->tdx, cp->tdy); -+ return; -+ } -+ - image->comps = (opj_image_comp_t*) opj_calloc(image->numcomps, sizeof(opj_image_comp_t)); - for (i = 0; i < image->numcomps; i++) { - int tmp, w, h; -@@ -506,6 +512,12 @@ - } - #endif /* USE_JPWL */ - -+ /* prevent division by zero */ -+ if (!(image->comps[i].dx * image->comps[i].dy)) { -+ opj_event_msg(j2k->cinfo, EVT_ERROR, "JPWL: invalid component size (dx: %d, dy: %d)\n", image->comps[i].dx, image->comps[i].dy); -+ return; -+ } -+ - /* TODO: unused ? */ - w = int_ceildiv(image->x1 - image->x0, image->comps[i].dx); - h = int_ceildiv(image->y1 - image->y0, image->comps[i].dy); diff --git a/mingw-w64-openjpeg/rhbz1036491_CVE-2013-6052.patch b/mingw-w64-openjpeg/rhbz1036491_CVE-2013-6052.patch deleted file mode 100644 index 6c26cc593b..0000000000 --- a/mingw-w64-openjpeg/rhbz1036491_CVE-2013-6052.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -rupN openjpeg-1.5.1/libopenjpeg/cio.c openjpeg-1.5.1-new/libopenjpeg/cio.c ---- openjpeg-1.5.1/libopenjpeg/cio.c 2012-09-13 09:58:39.000000000 +0200 -+++ openjpeg-1.5.1-new/libopenjpeg/cio.c 2013-12-05 10:25:07.717415888 +0100 -@@ -30,6 +30,7 @@ - */ - - #include "opj_includes.h" -+#include - - /* ----------------------------------------------------------------------- */ - -@@ -139,6 +140,11 @@ opj_bool cio_byteout(opj_cio_t *cio, uns - * Read a byte. - */ - unsigned char cio_bytein(opj_cio_t *cio) { -+ if (cio->bp < cio->start) { -+ opj_event_msg(cio->cinfo, EVT_ERROR, "read error: trying to read from before the start of the codestream (start = %d, current = %d, end = %d\n", cio->start, cio->bp, cio->end); -+ abort(); -+ return 0; -+ } - if (cio->bp >= cio->end) { - opj_event_msg(cio->cinfo, EVT_ERROR, "read error: passed the end of the codestream (start = %d, current = %d, end = %d\n", cio->start, cio->bp, cio->end); - return 0; -@@ -173,7 +179,7 @@ unsigned int cio_read(opj_cio_t *cio, in - unsigned int v; - v = 0; - for (i = n - 1; i >= 0; i--) { -- v += cio_bytein(cio) << (i << 3); -+ v += (unsigned int)cio_bytein(cio) << (i << 3); - } - return v; - } -@@ -184,6 +190,7 @@ unsigned int cio_read(opj_cio_t *cio, in - * n : number of bytes to skip - */ - void cio_skip(opj_cio_t *cio, int n) { -+ assert((cio->bp + n) >= cio->bp); - cio->bp += n; - } - -diff -rupN openjpeg-1.5.1/libopenjpeg/jp2.c openjpeg-1.5.1-new/libopenjpeg/jp2.c ---- openjpeg-1.5.1/libopenjpeg/jp2.c 2012-09-13 09:58:39.000000000 +0200 -+++ openjpeg-1.5.1-new/libopenjpeg/jp2.c 2013-12-05 10:25:07.718415907 +0100 -@@ -172,6 +172,9 @@ static opj_bool jp2_read_boxhdr(opj_comm - } - else if (box->length == 0) { - box->length = cio_numbytesleft(cio) + 8; -+ } else if (box->length < 0) { -+ opj_event_msg(cinfo, EVT_ERROR, "Invalid, negative, size of box\n"); -+ return OPJ_FALSE; - } - - return OPJ_TRUE; diff --git a/mingw-w64-openjpeg/rhbz1036493_CVE-2013-6053.patch b/mingw-w64-openjpeg/rhbz1036493_CVE-2013-6053.patch deleted file mode 100644 index d464b602ff..0000000000 --- a/mingw-w64-openjpeg/rhbz1036493_CVE-2013-6053.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: openjpeg-1.5.1/libopenjpeg/j2k.c -=================================================================== ---- openjpeg-1.5.1.orig/libopenjpeg/j2k.c 2013-01-01 01:01:01.000000000 +0000 -+++ openjpeg-1.5.1/libopenjpeg/j2k.c 2013-01-01 01:01:01.000000000 +0000 -@@ -422,7 +422,7 @@ static void j2k_read_siz(opj_j2k_t *j2k) - - if ((image->x0<0)||(image->x1<0)||(image->y0<0)||(image->y1<0)) { - opj_event_msg(j2k->cinfo, EVT_ERROR, -- "%s: invalid image size (x0:%d, x1:%d, y0:%d, y1:%d)\n", -+ "invalid image size (x0:%d, x1:%d, y0:%d, y1:%d)\n", - image->x0,image->x1,image->y0,image->y1); - return; - } diff --git a/mingw-w64-openjpeg/rhbz1036495_CVE-2013-6045.patch b/mingw-w64-openjpeg/rhbz1036495_CVE-2013-6045.patch deleted file mode 100644 index c85a22e2c5..0000000000 --- a/mingw-w64-openjpeg/rhbz1036495_CVE-2013-6045.patch +++ /dev/null @@ -1,93 +0,0 @@ -diff -rupN openjpeg-1.5.1/libopenjpeg/j2k.c openjpeg-1.5.1-new/libopenjpeg/j2k.c ---- openjpeg-1.5.1/libopenjpeg/j2k.c 2013-12-05 10:26:15.000000000 +0100 -+++ openjpeg-1.5.1-new/libopenjpeg/j2k.c 2013-12-05 10:32:34.752636957 +0100 -@@ -823,6 +823,12 @@ static void j2k_read_coc(opj_j2k_t *j2k) - - len = cio_read(cio, 2); /* Lcoc */ - compno = cio_read(cio, image->numcomps <= 256 ? 1 : 2); /* Ccoc */ -+ if ((compno < 0) || (compno >= image->numcomps)) { -+ opj_event_msg(j2k->cinfo, EVT_ERROR , -+ "bad component number in COC (%d out of a maximum of %d)\n", -+ compno, image->numcomps); -+ return; -+ } - tcp->tccps[compno].csty = cio_read(cio, 1); /* Scoc */ - j2k_read_cox(j2k, compno); - } -@@ -1004,8 +1010,18 @@ static void j2k_read_qcc(opj_j2k_t *j2k) - - /* keep your private count of tiles */ - backup_compno++; -- }; -+ } -+ else - #endif /* USE_JPWL */ -+ { -+ /* compno is negative or larger than the number of components!!! */ -+ if ((compno < 0) || (compno >= numcomp)) { -+ opj_event_msg(j2k->cinfo, EVT_ERROR, -+ "JPWL: bad component number in QCC (%d out of a maximum of %d)\n", -+ compno, numcomp); -+ return; -+ } -+ } - - j2k_read_qcx(j2k, compno, len - 2 - (numcomp <= 256 ? 1 : 2)); - } -@@ -1051,6 +1067,17 @@ static void j2k_read_poc(opj_j2k_t *j2k) - tcp->POC = 1; - len = cio_read(cio, 2); /* Lpoc */ - numpchgs = (len - 2) / (5 + 2 * (numcomps <= 256 ? 1 : 2)); -+ -+ { -+ /* old_poc < 0 "just in case" */ -+ int maxpocs = (sizeof(tcp->pocs)/sizeof(tcp->pocs[0])); -+ if ((old_poc < 0) || ((numpchgs + old_poc) >= maxpocs)) { -+ opj_event_msg(j2k->cinfo, EVT_ERROR, -+ "JPWL: bad number of progression order changes (%d out of a maximum of %d)\n", -+ (numpchgs + old_poc), maxpocs); -+ return; -+ } -+ } - - for (i = old_poc; i < numpchgs + old_poc; i++) { - opj_poc_t *poc; -@@ -1590,6 +1617,14 @@ static void j2k_read_rgn(opj_j2k_t *j2k) - }; - #endif /* USE_JPWL */ - -+ /* totlen is negative or larger than the bytes left!!! */ -+ if (compno >= numcomps) { -+ opj_event_msg(j2k->cinfo, EVT_ERROR, -+ "JPWL: bad component number in RGN (%d when there are only %d)\n", -+ compno, numcomps); -+ return; -+ } -+ - tcp->tccps[compno].roishift = cio_read(cio, 1); /* SPrgn */ - } - -diff -rupN openjpeg-1.5.1/libopenjpeg/tcd.c openjpeg-1.5.1-new/libopenjpeg/tcd.c ---- openjpeg-1.5.1/libopenjpeg/tcd.c 2012-09-13 09:58:39.000000000 +0200 -+++ openjpeg-1.5.1-new/libopenjpeg/tcd.c 2013-12-05 10:32:21.721452575 +0100 -@@ -1394,10 +1394,19 @@ opj_bool tcd_decode_tile(opj_tcd_t *tcd, - return OPJ_FALSE; - } - -+ int comp0size = (tile->comps[0].x1 - tile->comps[0].x0) * (tile->comps[0].y1 - tile->comps[0].y0); - for (compno = 0; compno < tile->numcomps; ++compno) { - opj_tcd_tilecomp_t* tilec = &tile->comps[compno]; -+ int compcsize = ((tilec->x1 - tilec->x0) * (tilec->y1 - tilec->y0)); -+ /* Later-on it is assumed that all components are of at least comp0size blocks */ -+ if (compcsize < comp0size) -+ { -+ opj_event_msg(tcd->cinfo, EVT_ERROR, "Error decoding tile. Component %d contains only %d blocks " -+ "while component 0 has %d blocks\n", compno, compcsize, comp0size); -+ return OPJ_FALSE; -+ } - /* The +3 is headroom required by the vectorized DWT */ -- tilec->data = (int*) opj_aligned_malloc((((tilec->x1 - tilec->x0) * (tilec->y1 - tilec->y0))+3) * sizeof(int)); -+ tilec->data = (int*) opj_aligned_malloc((comp0size+3) * sizeof(int)); - if (tilec->data == NULL) - { - opj_event_msg(tcd->cinfo, EVT_ERROR, "Out of memory\n"); diff --git a/mingw-w64-openjpeg/rhbz1037945_CVE-2013-1447.patch b/mingw-w64-openjpeg/rhbz1037945_CVE-2013-1447.patch deleted file mode 100644 index 5011d7c033..0000000000 --- a/mingw-w64-openjpeg/rhbz1037945_CVE-2013-1447.patch +++ /dev/null @@ -1,177 +0,0 @@ -diff -rupN openjpeg-1.5.1/libopenjpeg/cio.c openjpeg-1.5.1-new/libopenjpeg/cio.c ---- openjpeg-1.5.1/libopenjpeg/cio.c 2013-12-26 22:55:00.415086450 +0100 -+++ openjpeg-1.5.1-new/libopenjpeg/cio.c 2013-12-26 22:51:06.972354246 +0100 -@@ -107,6 +107,11 @@ int OPJ_CALLCONV cio_tell(opj_cio_t *cio - * pos : position, in number of bytes, from the beginning of the stream - */ - void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos) { -+ if ((cio->start + pos) > cio->end) { -+ opj_event_msg(cio->cinfo, EVT_ERROR, "error: trying to seek past the end of the codestream (start = %d, change = %d, end = %d\n", cio->start, pos, cio->end); -+ cio->bp = cio->end; -+ return; -+ } - cio->bp = cio->start + pos; - } - -@@ -114,6 +119,7 @@ void OPJ_CALLCONV cio_seek(opj_cio_t *ci - * Number of bytes left before the end of the stream. - */ - int cio_numbytesleft(opj_cio_t *cio) { -+ assert((cio->end - cio->bp) >= 0); - return cio->end - cio->bp; - } - -@@ -191,6 +197,11 @@ unsigned int cio_read(opj_cio_t *cio, in - */ - void cio_skip(opj_cio_t *cio, int n) { - assert((cio->bp + n) >= cio->bp); -+ if (((cio->bp + n) < cio->start) || ((cio->bp + n) > cio->end)) { -+ opj_event_msg(cio->cinfo, EVT_ERROR, "error: trying to skip bytes past the end of the codestream (current = %d, change = %d, end = %d\n", cio->bp, n, cio->end); -+ cio->bp = cio->end; -+ return; -+ } - cio->bp += n; - } - -diff -rupN openjpeg-1.5.1/libopenjpeg/j2k.c openjpeg-1.5.1-new/libopenjpeg/j2k.c ---- openjpeg-1.5.1/libopenjpeg/j2k.c 2013-12-26 22:55:00.420086508 +0100 -+++ openjpeg-1.5.1-new/libopenjpeg/j2k.c 2013-12-26 22:53:10.965808939 +0100 -@@ -476,7 +476,7 @@ static void j2k_read_siz(opj_j2k_t *j2k) - - image->comps = (opj_image_comp_t*) opj_calloc(image->numcomps, sizeof(opj_image_comp_t)); - for (i = 0; i < image->numcomps; i++) { -- int tmp, w, h; -+ int tmp/*, w, h*/; - tmp = cio_read(cio, 1); /* Ssiz_i */ - image->comps[i].prec = (tmp & 0x7f) + 1; - image->comps[i].sgnd = tmp >> 7; -@@ -511,6 +511,14 @@ static void j2k_read_siz(opj_j2k_t *j2k) - - } - #endif /* USE_JPWL */ -+ { -+ if (!(image->comps[i].dx * image->comps[i].dy)) { -+ opj_event_msg(j2k->cinfo, EVT_ERROR, -+ "JPWL: bad XRsiz_%d/YRsiz_%d (%d x %d)\n", -+ i, i, image->comps[i].dx, image->comps[i].dy); -+ return; -+ } -+ } - - /* prevent division by zero */ - if (!(image->comps[i].dx * image->comps[i].dy)) { -@@ -519,8 +527,8 @@ static void j2k_read_siz(opj_j2k_t *j2k) - } - - /* TODO: unused ? */ -- w = int_ceildiv(image->x1 - image->x0, image->comps[i].dx); -- h = int_ceildiv(image->y1 - image->y0, image->comps[i].dy); -+/* w = int_ceildiv(image->x1 - image->x0, image->comps[i].dx); -+ h = int_ceildiv(image->y1 - image->y0, image->comps[i].dy);*/ - - image->comps[i].resno_decoded = 0; /* number of resolution decoded */ - image->comps[i].factor = cp->reduce; /* reducing factor per component */ -@@ -2011,6 +2019,11 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, - } - if (j2k->state == J2K_STATE_NEOC) { - j2k_read_eoc(j2k); -+ /* Check one last time for errors during decoding before returning */ -+ if (j2k->state & J2K_STATE_ERR) { -+ opj_image_destroy(image); -+ return NULL; -+ } - } - - if (j2k->state != J2K_STATE_MT) { -diff -rupN openjpeg-1.5.1/libopenjpeg/jp2.c openjpeg-1.5.1-new/libopenjpeg/jp2.c ---- openjpeg-1.5.1/libopenjpeg/jp2.c 2013-12-26 22:55:00.415086450 +0100 -+++ openjpeg-1.5.1-new/libopenjpeg/jp2.c 2013-12-26 22:51:06.973354258 +0100 -@@ -815,6 +815,17 @@ void jp2_write_jp2h(opj_jp2_t *jp2, opj_ - - jp2_write_ihdr(jp2, cio); - -+ { -+ int curpos = cio_tell(cio); -+ cio_seek(cio, box.init_pos); -+ cio_skip(cio, box.length); -+ if ((cio_tell(cio) - box.init_pos) != box.length) { -+ opj_event_msg(jp2->cinfo, EVT_ERROR, "Box size exceeds size of codestream (expected: %d, real: %d)\n", box.length, (cio_tell(cio) - box.init_pos)); -+ return OPJ_FALSE; -+ } -+ cio_seek(cio, curpos); -+ } -+ - if (jp2->bpc == 255) { - jp2_write_bpcc(jp2, cio); - } -@@ -867,6 +878,13 @@ static opj_bool jp2_read_ftyp(opj_jp2_t - jp2->numcl = (box.length - 16) / 4; - jp2->cl = (unsigned int *) opj_malloc(jp2->numcl * sizeof(unsigned int)); - -+ if (cio_numbytesleft(cio) < ((int)jp2->numcl * 4)) { -+ opj_event_msg(cinfo, EVT_ERROR, "Not enough bytes in FTYP Box " -+ "(expected %d, but only %d left)\n", -+ ((int)jp2->numcl * 4), cio_numbytesleft(cio)); -+ return OPJ_FALSE; -+ } -+ - for (i = 0; i < (int)jp2->numcl; i++) { - jp2->cl[i] = cio_read(cio, 4); /* CLi */ - } -diff -rupN openjpeg-1.5.1/libopenjpeg/opj_malloc.h openjpeg-1.5.1-new/libopenjpeg/opj_malloc.h ---- openjpeg-1.5.1/libopenjpeg/opj_malloc.h 2012-09-13 09:58:39.000000000 +0200 -+++ openjpeg-1.5.1-new/libopenjpeg/opj_malloc.h 2013-12-26 22:52:52.498592823 +0100 -@@ -48,7 +48,7 @@ Allocate an uninitialized memory block - #ifdef ALLOC_PERF_OPT - void * OPJ_CALLCONV opj_malloc(size_t size); - #else --#define opj_malloc(size) malloc(size) -+#define opj_malloc(size) calloc(1, size) - #endif - - /** -diff -rupN openjpeg-1.5.1/libopenjpeg/t2.c openjpeg-1.5.1-new/libopenjpeg/t2.c ---- openjpeg-1.5.1/libopenjpeg/t2.c 2012-09-13 09:58:39.000000000 +0200 -+++ openjpeg-1.5.1-new/libopenjpeg/t2.c 2013-12-26 22:51:19.124497216 +0100 -@@ -340,6 +340,11 @@ static int t2_decode_packet(opj_t2_t* t2 - int precno = pi->precno; /* precinct value */ - int layno = pi->layno; /* quality layer value */ - -+ if (!&(tile->comps[compno])) { -+ opj_event_msg(t2->cinfo, EVT_ERROR, "Trying to decode tile with no components!\n"); -+ return -999; -+ } -+ - opj_tcd_resolution_t* res = &tile->comps[compno].resolutions[resno]; - - unsigned char *hd = NULL; -diff -rupN openjpeg-1.5.1/libopenjpeg/tcd.c openjpeg-1.5.1-new/libopenjpeg/tcd.c ---- openjpeg-1.5.1/libopenjpeg/tcd.c 2013-12-26 22:55:00.420086508 +0100 -+++ openjpeg-1.5.1-new/libopenjpeg/tcd.c 2013-12-26 22:54:20.653622972 +0100 -@@ -667,8 +667,8 @@ void tcd_malloc_decode(opj_tcd_t *tcd, o - y1 = j == 0 ? tilec->y1 : int_max(y1, (unsigned int) tilec->y1); - } - -- w = int_ceildivpow2(x1 - x0, image->comps[i].factor); -- h = int_ceildivpow2(y1 - y0, image->comps[i].factor); -+ w = int_ceildivpow2((long)(x1) - (long)(x0), image->comps[i].factor); -+ h = int_ceildivpow2((long)(y1) - (long)(y0), image->comps[i].factor); - - image->comps[i].w = w; - image->comps[i].h = h; -@@ -1381,7 +1381,15 @@ opj_bool tcd_decode_tile(opj_tcd_t *tcd, - if (l == -999) { - eof = 1; - opj_event_msg(tcd->cinfo, EVT_ERROR, "tcd_decode: incomplete bistream\n"); -+ return OPJ_FALSE; - } -+ -+ /* The code below assumes that numcomps > 0 */ -+ if (tile->numcomps <= 0) { -+ opj_event_msg(tcd->cinfo, EVT_ERROR, "tcd_decode: tile has a zero or negative numcomps\n"); -+ return OPJ_TRUE; -+ } -+ - - /*------------------TIER1-----------------*/ - diff --git a/mingw-w64-openjpeg/rhbz1037948_CVE-2013-6887.patch b/mingw-w64-openjpeg/rhbz1037948_CVE-2013-6887.patch deleted file mode 100644 index f42aafb393..0000000000 --- a/mingw-w64-openjpeg/rhbz1037948_CVE-2013-6887.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: openjpeg-1.5.1/libopenjpeg/j2k.c -=================================================================== ---- openjpeg-1.5.1.orig/libopenjpeg/j2k.c 2013-01-01 01:01:01.000000000 +0000 -+++ openjpeg-1.5.1/libopenjpeg/j2k.c 2013-01-01 01:01:01.000000000 +0000 -@@ -1673,8 +1673,11 @@ static void j2k_read_eoc(opj_j2k_t *j2k) - else { - for (i = 0; i < j2k->cp->tileno_size; i++) { - tileno = j2k->cp->tileno[i]; -- opj_free(j2k->tile_data[tileno]); -- j2k->tile_data[tileno] = NULL; -+ /* not sure if this can actually happen */ -+ if (tileno != -1) { -+ opj_free(j2k->tile_data[tileno]); -+ j2k->tile_data[tileno] = NULL; -+ } - } - } - if (j2k->state & J2K_STATE_ERR) -@@ -1834,8 +1837,10 @@ void j2k_destroy_decompress(opj_j2k_t *j - if(j2k->cp != NULL) { - for (i = 0; i < j2k->cp->tileno_size; i++) { - int tileno = j2k->cp->tileno[i]; -- opj_free(j2k->tile_data[tileno]); -- j2k->tile_data[tileno] = NULL; -+ if (tileno != -1) { -+ opj_free(j2k->tile_data[tileno]); -+ j2k->tile_data[tileno] = NULL; -+ } - } - } -