wok-next rev 19753
Up jasper, lcms, lcms2, libjpeg-turbo, liblinebreak, net-snmp.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu Jun 08 23:54:41 2017 +0300 (2017-06-08) |
parents | 9610a0d739a2 |
children | 9b82f2f67b15 |
files | jasper-dev/receipt jasper/receipt jasper/stuff/patches/jasper-1.900.1-security_fixes-2.patch jasper/stuff/patches/series jpeg-turbo/receipt lcms-apps/receipt lcms-dev/receipt lcms/receipt lcms2-apps/receipt lcms2-dev/receipt lcms2/receipt libjpeg-turbo-dev/receipt libjpeg-turbo/receipt liblinebreak-dev/receipt liblinebreak/receipt net-snmp/receipt |
line diff
1.1 --- a/jasper-dev/receipt Thu Jun 08 19:49:38 2017 +0300 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,19 +0,0 @@ 1.4 -# SliTaz package receipt. 1.5 - 1.6 -PACKAGE="jasper-dev" 1.7 -VERSION="1.900.1" 1.8 -CATEGORY="development" 1.9 -SHORT_DESC="Implementation of JPEG-2000 codec (development files)" 1.10 -MAINTAINER="jozee@slitaz.org" 1.11 -LICENSE="MIT" 1.12 -WEB_SITE="http://www.ece.uvic.ca/~mdadams/jasper/" 1.13 -HOST_ARCH="i486 arm" 1.14 - 1.15 -WANTED="jasper" 1.16 -DEPENDS="jasper" 1.17 - 1.18 -# Rules to gen a SliTaz package suitable for Tazpkg. 1.19 -genpkg_rules() 1.20 -{ 1.21 - cook_copy_files *.h *.la 1.22 -}
2.1 --- a/jasper/receipt Thu Jun 08 19:49:38 2017 +0300 2.2 +++ b/jasper/receipt Thu Jun 08 23:54:41 2017 +0300 2.3 @@ -1,40 +1,39 @@ 2.4 -# SliTaz package receipt. 2.5 +# SliTaz package receipt v2. 2.6 2.7 PACKAGE="jasper" 2.8 -VERSION="1.900.1" 2.9 +VERSION="2.0.12" 2.10 CATEGORY="graphics" 2.11 SHORT_DESC="Implementation of JPEG-2000 codec" 2.12 MAINTAINER="jozee@slitaz.org" 2.13 LICENSE="MIT" 2.14 -WEB_SITE="http://www.ece.uvic.ca/~mdadams/jasper/" 2.15 -TAGS="jpeg jpg photo" 2.16 +WEB_SITE="http://www.ece.uvic.ca/~frodo/jasper/" 2.17 HOST_ARCH="i486 arm" 2.18 2.19 -TARBALL="$PACKAGE-$VERSION.zip" 2.20 +TARBALL="$PACKAGE-$VERSION.tar.gz" 2.21 WGET_URL="${WEB_SITE}software/$TARBALL" 2.22 2.23 -DEPENDS="" 2.24 -BUILD_DEPENDS="gfortran xorg-libX11-dev" 2.25 +BUILD_DEPENDS="cmake libjpeg-turbo-dev" 2.26 +SPLIT="jasper-dev" 2.27 2.28 # Rules to configure and make the package. 2.29 compile_rules() 2.30 { 2.31 - while read i; do patch -p1 -i $stuff/patches/$i; done < $stuff/patches/series 2.32 - 2.33 - ./configure \ 2.34 - --enable-shared \ 2.35 - --disable-static \ 2.36 - --mandir=/usr/share/man \ 2.37 - $CONFIGURE_ARGS && 2.38 - make && make install && 2.39 - 2.40 - install -v -m755 -d $install/usr/share/doc/jasper-$VERSION && 2.41 - install -v -m644 doc/*.pdf $install/usr/share/doc/jasper-$VERSION 2.42 + mkdir -p build 2.43 + cmake -G "Unix Makefiles" -H. -Bbuild -DCMAKE_INSTALL_PREFIX=/usr 2.44 + cd build 2.45 + make clean all && 2.46 + make install 2.47 } 2.48 2.49 # Rules to gen a SliTaz package suitable for Tazpkg. 2.50 genpkg_rules() 2.51 { 2.52 - cook_copy_folders bin 2.53 - cook_copy_files *.so* 2.54 + case $PACKAGE in 2.55 + jasper) 2.56 + copy @std 2.57 + DEPENDS="libjpeg-turbo" 2.58 + TAGS="jpeg jpg photo" 2.59 + ;; 2.60 + *-dev) copy @dev;; 2.61 + esac 2.62 }
3.1 --- a/jasper/stuff/patches/jasper-1.900.1-security_fixes-2.patch Thu Jun 08 19:49:38 2017 +0300 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,1302 +0,0 @@ 3.4 -Submitted By: Armin K. <krejzi at email dot com> 3.5 -Date: 2015-01-28 3.6 -Initial Package Version: 1.900.1 3.7 -Upstream Status: Unknown 3.8 -Origin: Archlinux 3.9 -Description: Fixes multiple security issues, including: 3.10 - CVE-2008-3520, CVE-2008-3522, CVE-2011-4516, CVE-2011-4517, 3.11 - CVE-2014-8137, CVE-2014-8138, CVE-2014-8157, CVE-2014-8158 and 3.12 - CVE-2014-9029. Filename buffer overflow and Stepsizes overflow. 3.13 - 3.14 ---- a/src/libjasper/base/jas_cm.c 2007-01-19 22:43:05.000000000 +0100 3.15 -+++ b/src/libjasper/base/jas_cm.c 2015-01-28 17:57:34.114045370 +0100 3.16 -@@ -704,8 +704,7 @@ 3.17 - { 3.18 - jas_cmpxform_t **p; 3.19 - assert(n >= pxformseq->numpxforms); 3.20 -- p = (!pxformseq->pxforms) ? jas_malloc(n * sizeof(jas_cmpxform_t *)) : 3.21 -- jas_realloc(pxformseq->pxforms, n * sizeof(jas_cmpxform_t *)); 3.22 -+ p = jas_realloc2(pxformseq->pxforms, n, sizeof(jas_cmpxform_t *)); 3.23 - if (!p) { 3.24 - return -1; 3.25 - } 3.26 -@@ -889,13 +888,13 @@ 3.27 - jas_cmshapmatlut_cleanup(lut); 3.28 - if (curv->numents == 0) { 3.29 - lut->size = 2; 3.30 -- if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t)))) 3.31 -+ if (!(lut->data = jas_alloc2(lut->size, sizeof(jas_cmreal_t)))) 3.32 - goto error; 3.33 - lut->data[0] = 0.0; 3.34 - lut->data[1] = 1.0; 3.35 - } else if (curv->numents == 1) { 3.36 - lut->size = 256; 3.37 -- if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t)))) 3.38 -+ if (!(lut->data = jas_alloc2(lut->size, sizeof(jas_cmreal_t)))) 3.39 - goto error; 3.40 - gamma = curv->ents[0] / 256.0; 3.41 - for (i = 0; i < lut->size; ++i) { 3.42 -@@ -903,7 +902,7 @@ 3.43 - } 3.44 - } else { 3.45 - lut->size = curv->numents; 3.46 -- if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t)))) 3.47 -+ if (!(lut->data = jas_alloc2(lut->size, sizeof(jas_cmreal_t)))) 3.48 - goto error; 3.49 - for (i = 0; i < lut->size; ++i) { 3.50 - lut->data[i] = curv->ents[i] / 65535.0; 3.51 -@@ -953,7 +952,7 @@ 3.52 - return -1; 3.53 - } 3.54 - } 3.55 -- if (!(invlut->data = jas_malloc(n * sizeof(jas_cmreal_t)))) 3.56 -+ if (!(invlut->data = jas_alloc2(n, sizeof(jas_cmreal_t)))) 3.57 - return -1; 3.58 - invlut->size = n; 3.59 - for (i = 0; i < invlut->size; ++i) { 3.60 ---- a/src/libjasper/base/jas_icc.c 2007-01-19 22:43:05.000000000 +0100 3.61 -+++ b/src/libjasper/base/jas_icc.c 2015-01-28 17:58:32.874025377 +0100 3.62 -@@ -373,7 +373,7 @@ 3.63 - jas_icctagtab_t *tagtab; 3.64 - 3.65 - tagtab = &prof->tagtab; 3.66 -- if (!(tagtab->ents = jas_malloc(prof->attrtab->numattrs * 3.67 -+ if (!(tagtab->ents = jas_alloc2(prof->attrtab->numattrs, 3.68 - sizeof(jas_icctagtabent_t)))) 3.69 - goto error; 3.70 - tagtab->numents = prof->attrtab->numattrs; 3.71 -@@ -522,7 +522,7 @@ 3.72 - } 3.73 - if (jas_iccgetuint32(in, &tagtab->numents)) 3.74 - goto error; 3.75 -- if (!(tagtab->ents = jas_malloc(tagtab->numents * 3.76 -+ if (!(tagtab->ents = jas_alloc2(tagtab->numents, 3.77 - sizeof(jas_icctagtabent_t)))) 3.78 - goto error; 3.79 - tagtabent = tagtab->ents; 3.80 -@@ -743,8 +743,7 @@ 3.81 - { 3.82 - jas_iccattr_t *newattrs; 3.83 - assert(maxents >= tab->numattrs); 3.84 -- newattrs = tab->attrs ? jas_realloc(tab->attrs, maxents * 3.85 -- sizeof(jas_iccattr_t)) : jas_malloc(maxents * sizeof(jas_iccattr_t)); 3.86 -+ newattrs = jas_realloc2(tab->attrs, maxents, sizeof(jas_iccattr_t)); 3.87 - if (!newattrs) 3.88 - return -1; 3.89 - tab->attrs = newattrs; 3.90 -@@ -999,7 +998,7 @@ 3.91 - 3.92 - if (jas_iccgetuint32(in, &curv->numents)) 3.93 - goto error; 3.94 -- if (!(curv->ents = jas_malloc(curv->numents * sizeof(jas_iccuint16_t)))) 3.95 -+ if (!(curv->ents = jas_alloc2(curv->numents, sizeof(jas_iccuint16_t)))) 3.96 - goto error; 3.97 - for (i = 0; i < curv->numents; ++i) { 3.98 - if (jas_iccgetuint16(in, &curv->ents[i])) 3.99 -@@ -1011,7 +1010,6 @@ 3.100 - return 0; 3.101 - 3.102 - error: 3.103 -- jas_icccurv_destroy(attrval); 3.104 - return -1; 3.105 - } 3.106 - 3.107 -@@ -1100,7 +1098,7 @@ 3.108 - if (jas_iccgetuint32(in, &txtdesc->uclangcode) || 3.109 - jas_iccgetuint32(in, &txtdesc->uclen)) 3.110 - goto error; 3.111 -- if (!(txtdesc->ucdata = jas_malloc(txtdesc->uclen * 2))) 3.112 -+ if (!(txtdesc->ucdata = jas_alloc2(txtdesc->uclen, 2))) 3.113 - goto error; 3.114 - if (jas_stream_read(in, txtdesc->ucdata, txtdesc->uclen * 2) != 3.115 - JAS_CAST(int, txtdesc->uclen * 2)) 3.116 -@@ -1129,7 +1127,6 @@ 3.117 - #endif 3.118 - return 0; 3.119 - error: 3.120 -- jas_icctxtdesc_destroy(attrval); 3.121 - return -1; 3.122 - } 3.123 - 3.124 -@@ -1208,8 +1205,6 @@ 3.125 - goto error; 3.126 - return 0; 3.127 - error: 3.128 -- if (txt->string) 3.129 -- jas_free(txt->string); 3.130 - return -1; 3.131 - } 3.132 - 3.133 -@@ -1292,17 +1287,17 @@ 3.134 - jas_iccgetuint16(in, &lut8->numouttabents)) 3.135 - goto error; 3.136 - clutsize = jas_iccpowi(lut8->clutlen, lut8->numinchans) * lut8->numoutchans; 3.137 -- if (!(lut8->clut = jas_malloc(clutsize * sizeof(jas_iccuint8_t))) || 3.138 -- !(lut8->intabsbuf = jas_malloc(lut8->numinchans * 3.139 -- lut8->numintabents * sizeof(jas_iccuint8_t))) || 3.140 -- !(lut8->intabs = jas_malloc(lut8->numinchans * 3.141 -+ if (!(lut8->clut = jas_alloc2(clutsize, sizeof(jas_iccuint8_t))) || 3.142 -+ !(lut8->intabsbuf = jas_alloc3(lut8->numinchans, 3.143 -+ lut8->numintabents, sizeof(jas_iccuint8_t))) || 3.144 -+ !(lut8->intabs = jas_alloc2(lut8->numinchans, 3.145 - sizeof(jas_iccuint8_t *)))) 3.146 - goto error; 3.147 - for (i = 0; i < lut8->numinchans; ++i) 3.148 - lut8->intabs[i] = &lut8->intabsbuf[i * lut8->numintabents]; 3.149 -- if (!(lut8->outtabsbuf = jas_malloc(lut8->numoutchans * 3.150 -- lut8->numouttabents * sizeof(jas_iccuint8_t))) || 3.151 -- !(lut8->outtabs = jas_malloc(lut8->numoutchans * 3.152 -+ if (!(lut8->outtabsbuf = jas_alloc3(lut8->numoutchans, 3.153 -+ lut8->numouttabents, sizeof(jas_iccuint8_t))) || 3.154 -+ !(lut8->outtabs = jas_alloc2(lut8->numoutchans, 3.155 - sizeof(jas_iccuint8_t *)))) 3.156 - goto error; 3.157 - for (i = 0; i < lut8->numoutchans; ++i) 3.158 -@@ -1330,7 +1325,6 @@ 3.159 - goto error; 3.160 - return 0; 3.161 - error: 3.162 -- jas_icclut8_destroy(attrval); 3.163 - return -1; 3.164 - } 3.165 - 3.166 -@@ -1461,17 +1455,17 @@ 3.167 - jas_iccgetuint16(in, &lut16->numouttabents)) 3.168 - goto error; 3.169 - clutsize = jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans; 3.170 -- if (!(lut16->clut = jas_malloc(clutsize * sizeof(jas_iccuint16_t))) || 3.171 -- !(lut16->intabsbuf = jas_malloc(lut16->numinchans * 3.172 -- lut16->numintabents * sizeof(jas_iccuint16_t))) || 3.173 -- !(lut16->intabs = jas_malloc(lut16->numinchans * 3.174 -+ if (!(lut16->clut = jas_alloc2(clutsize, sizeof(jas_iccuint16_t))) || 3.175 -+ !(lut16->intabsbuf = jas_alloc3(lut16->numinchans, 3.176 -+ lut16->numintabents, sizeof(jas_iccuint16_t))) || 3.177 -+ !(lut16->intabs = jas_alloc2(lut16->numinchans, 3.178 - sizeof(jas_iccuint16_t *)))) 3.179 - goto error; 3.180 - for (i = 0; i < lut16->numinchans; ++i) 3.181 - lut16->intabs[i] = &lut16->intabsbuf[i * lut16->numintabents]; 3.182 -- if (!(lut16->outtabsbuf = jas_malloc(lut16->numoutchans * 3.183 -- lut16->numouttabents * sizeof(jas_iccuint16_t))) || 3.184 -- !(lut16->outtabs = jas_malloc(lut16->numoutchans * 3.185 -+ if (!(lut16->outtabsbuf = jas_alloc3(lut16->numoutchans, 3.186 -+ lut16->numouttabents, sizeof(jas_iccuint16_t))) || 3.187 -+ !(lut16->outtabs = jas_alloc2(lut16->numoutchans, 3.188 - sizeof(jas_iccuint16_t *)))) 3.189 - goto error; 3.190 - for (i = 0; i < lut16->numoutchans; ++i) 3.191 -@@ -1499,7 +1493,6 @@ 3.192 - goto error; 3.193 - return 0; 3.194 - error: 3.195 -- jas_icclut16_destroy(attrval); 3.196 - return -1; 3.197 - } 3.198 - 3.199 ---- a/src/libjasper/base/jas_image.c 2007-01-19 22:43:05.000000000 +0100 3.200 -+++ b/src/libjasper/base/jas_image.c 2015-01-28 17:57:34.116045403 +0100 3.201 -@@ -142,7 +142,7 @@ 3.202 - image->inmem_ = true; 3.203 - 3.204 - /* Allocate memory for the per-component information. */ 3.205 -- if (!(image->cmpts_ = jas_malloc(image->maxcmpts_ * 3.206 -+ if (!(image->cmpts_ = jas_alloc2(image->maxcmpts_, 3.207 - sizeof(jas_image_cmpt_t *)))) { 3.208 - jas_image_destroy(image); 3.209 - return 0; 3.210 -@@ -774,8 +774,7 @@ 3.211 - jas_image_cmpt_t **newcmpts; 3.212 - int cmptno; 3.213 - 3.214 -- newcmpts = (!image->cmpts_) ? jas_malloc(maxcmpts * sizeof(jas_image_cmpt_t *)) : 3.215 -- jas_realloc(image->cmpts_, maxcmpts * sizeof(jas_image_cmpt_t *)); 3.216 -+ newcmpts = jas_realloc2(image->cmpts_, maxcmpts, sizeof(jas_image_cmpt_t *)); 3.217 - if (!newcmpts) { 3.218 - return -1; 3.219 - } 3.220 ---- a/src/libjasper/base/jas_malloc.c 2007-01-19 22:43:05.000000000 +0100 3.221 -+++ b/src/libjasper/base/jas_malloc.c 2015-01-28 17:57:34.116045403 +0100 3.222 -@@ -76,6 +76,9 @@ 3.223 - 3.224 - /* We need the prototype for memset. */ 3.225 - #include <string.h> 3.226 -+#include <limits.h> 3.227 -+#include <errno.h> 3.228 -+#include <stdint.h> 3.229 - 3.230 - #include "jasper/jas_malloc.h" 3.231 - 3.232 -@@ -113,18 +116,50 @@ 3.233 - 3.234 - void *jas_realloc(void *ptr, size_t size) 3.235 - { 3.236 -- return realloc(ptr, size); 3.237 -+ return ptr ? realloc(ptr, size) : malloc(size); 3.238 - } 3.239 - 3.240 --void *jas_calloc(size_t nmemb, size_t size) 3.241 -+void *jas_realloc2(void *ptr, size_t nmemb, size_t size) 3.242 -+{ 3.243 -+ if (!ptr) 3.244 -+ return jas_alloc2(nmemb, size); 3.245 -+ if (nmemb && SIZE_MAX / nmemb < size) { 3.246 -+ errno = ENOMEM; 3.247 -+ return NULL; 3.248 -+ } 3.249 -+ return jas_realloc(ptr, nmemb * size); 3.250 -+ 3.251 -+} 3.252 -+ 3.253 -+void *jas_alloc2(size_t nmemb, size_t size) 3.254 -+{ 3.255 -+ if (nmemb && SIZE_MAX / nmemb < size) { 3.256 -+ errno = ENOMEM; 3.257 -+ return NULL; 3.258 -+ } 3.259 -+ 3.260 -+ return jas_malloc(nmemb * size); 3.261 -+} 3.262 -+ 3.263 -+void *jas_alloc3(size_t a, size_t b, size_t c) 3.264 - { 3.265 -- void *ptr; 3.266 - size_t n; 3.267 -- n = nmemb * size; 3.268 -- if (!(ptr = jas_malloc(n * sizeof(char)))) { 3.269 -- return 0; 3.270 -+ 3.271 -+ if (a && SIZE_MAX / a < b) { 3.272 -+ errno = ENOMEM; 3.273 -+ return NULL; 3.274 - } 3.275 -- memset(ptr, 0, n); 3.276 -+ 3.277 -+ return jas_alloc2(a*b, c); 3.278 -+} 3.279 -+ 3.280 -+void *jas_calloc(size_t nmemb, size_t size) 3.281 -+{ 3.282 -+ void *ptr; 3.283 -+ 3.284 -+ ptr = jas_alloc2(nmemb, size); 3.285 -+ if (ptr) 3.286 -+ memset(ptr, 0, nmemb*size); 3.287 - return ptr; 3.288 - } 3.289 - 3.290 ---- a/src/libjasper/base/jas_seq.c 2007-01-19 22:43:05.000000000 +0100 3.291 -+++ b/src/libjasper/base/jas_seq.c 2015-01-28 17:57:34.116045403 +0100 3.292 -@@ -114,7 +114,7 @@ 3.293 - matrix->datasize_ = numrows * numcols; 3.294 - 3.295 - if (matrix->maxrows_ > 0) { 3.296 -- if (!(matrix->rows_ = jas_malloc(matrix->maxrows_ * 3.297 -+ if (!(matrix->rows_ = jas_alloc2(matrix->maxrows_, 3.298 - sizeof(jas_seqent_t *)))) { 3.299 - jas_matrix_destroy(matrix); 3.300 - return 0; 3.301 -@@ -122,7 +122,7 @@ 3.302 - } 3.303 - 3.304 - if (matrix->datasize_ > 0) { 3.305 -- if (!(matrix->data_ = jas_malloc(matrix->datasize_ * 3.306 -+ if (!(matrix->data_ = jas_alloc2(matrix->datasize_, 3.307 - sizeof(jas_seqent_t)))) { 3.308 - jas_matrix_destroy(matrix); 3.309 - return 0; 3.310 -@@ -220,7 +220,7 @@ 3.311 - mat0->numrows_ = r1 - r0 + 1; 3.312 - mat0->numcols_ = c1 - c0 + 1; 3.313 - mat0->maxrows_ = mat0->numrows_; 3.314 -- mat0->rows_ = jas_malloc(mat0->maxrows_ * sizeof(jas_seqent_t *)); 3.315 -+ mat0->rows_ = jas_alloc2(mat0->maxrows_, sizeof(jas_seqent_t *)); 3.316 - for (i = 0; i < mat0->numrows_; ++i) { 3.317 - mat0->rows_[i] = mat1->rows_[r0 + i] + c0; 3.318 - } 3.319 ---- a/src/libjasper/base/jas_stream.c 2007-01-19 22:43:05.000000000 +0100 3.320 -+++ b/src/libjasper/base/jas_stream.c 2015-01-28 17:57:57.483434550 +0100 3.321 -@@ -212,7 +212,7 @@ 3.322 - if (buf) { 3.323 - obj->buf_ = (unsigned char *) buf; 3.324 - } else { 3.325 -- obj->buf_ = jas_malloc(obj->bufsize_ * sizeof(char)); 3.326 -+ obj->buf_ = jas_malloc(obj->bufsize_); 3.327 - obj->myalloc_ = 1; 3.328 - } 3.329 - if (!obj->buf_) { 3.330 -@@ -553,7 +553,7 @@ 3.331 - int ret; 3.332 - 3.333 - va_start(ap, fmt); 3.334 -- ret = vsprintf(buf, fmt, ap); 3.335 -+ ret = vsnprintf(buf, sizeof buf, fmt, ap); 3.336 - jas_stream_puts(stream, buf); 3.337 - va_end(ap); 3.338 - return ret; 3.339 -@@ -992,7 +992,7 @@ 3.340 - unsigned char *buf; 3.341 - 3.342 - assert(m->buf_); 3.343 -- if (!(buf = jas_realloc(m->buf_, bufsize * sizeof(unsigned char)))) { 3.344 -+ if (!(buf = jas_realloc(m->buf_, bufsize))) { 3.345 - return -1; 3.346 - } 3.347 - m->buf_ = buf; 3.348 ---- a/src/libjasper/bmp/bmp_dec.c 2007-01-19 22:43:07.000000000 +0100 3.349 -+++ b/src/libjasper/bmp/bmp_dec.c 2015-01-28 17:57:34.117045420 +0100 3.350 -@@ -283,7 +283,7 @@ 3.351 - } 3.352 - 3.353 - if (info->numcolors > 0) { 3.354 -- if (!(info->palents = jas_malloc(info->numcolors * 3.355 -+ if (!(info->palents = jas_alloc2(info->numcolors, 3.356 - sizeof(bmp_palent_t)))) { 3.357 - bmp_info_destroy(info); 3.358 - return 0; 3.359 ---- a/src/libjasper/include/jasper/jas_malloc.h 2007-01-19 22:43:04.000000000 +0100 3.360 -+++ b/src/libjasper/include/jasper/jas_malloc.h 2015-01-28 17:57:34.118045437 +0100 3.361 -@@ -95,6 +95,9 @@ 3.362 - #define jas_free MEMFREE 3.363 - #define jas_realloc MEMREALLOC 3.364 - #define jas_calloc MEMCALLOC 3.365 -+#define jas_alloc2(a, b) MEMALLOC((a)*(b)) 3.366 -+#define jas_alloc3(a, b, c) MEMALLOC((a)*(b)*(c)) 3.367 -+#define jas_realloc2(p, a, b) MEMREALLOC((p), (a)*(b)) 3.368 - #endif 3.369 - 3.370 - /******************************************************************************\ 3.371 -@@ -115,6 +118,12 @@ 3.372 - /* Allocate a block of memory and initialize the contents to zero. */ 3.373 - void *jas_calloc(size_t nmemb, size_t size); 3.374 - 3.375 -+/* size-checked double allocation .*/ 3.376 -+void *jas_alloc2(size_t, size_t); 3.377 -+ 3.378 -+void *jas_alloc3(size_t, size_t, size_t); 3.379 -+ 3.380 -+void *jas_realloc2(void *, size_t, size_t); 3.381 - #endif 3.382 - 3.383 - #ifdef __cplusplus 3.384 ---- a/src/libjasper/jp2/jp2_cod.c 2007-01-19 22:43:05.000000000 +0100 3.385 -+++ b/src/libjasper/jp2/jp2_cod.c 2015-01-28 17:57:34.118045437 +0100 3.386 -@@ -247,7 +247,7 @@ 3.387 - box = 0; 3.388 - tmpstream = 0; 3.389 - 3.390 -- if (!(box = jas_malloc(sizeof(jp2_box_t)))) { 3.391 -+ if (!(box = jas_calloc(1, sizeof(jp2_box_t)))) { 3.392 - goto error; 3.393 - } 3.394 - box->ops = &jp2_boxinfo_unk.ops; 3.395 -@@ -372,7 +372,7 @@ 3.396 - jp2_bpcc_t *bpcc = &box->data.bpcc; 3.397 - unsigned int i; 3.398 - bpcc->numcmpts = box->datalen; 3.399 -- if (!(bpcc->bpcs = jas_malloc(bpcc->numcmpts * sizeof(uint_fast8_t)))) { 3.400 -+ if (!(bpcc->bpcs = jas_alloc2(bpcc->numcmpts, sizeof(uint_fast8_t)))) { 3.401 - return -1; 3.402 - } 3.403 - for (i = 0; i < bpcc->numcmpts; ++i) { 3.404 -@@ -416,7 +416,7 @@ 3.405 - break; 3.406 - case JP2_COLR_ICC: 3.407 - colr->iccplen = box->datalen - 3; 3.408 -- if (!(colr->iccp = jas_malloc(colr->iccplen * sizeof(uint_fast8_t)))) { 3.409 -+ if (!(colr->iccp = jas_alloc2(colr->iccplen, sizeof(uint_fast8_t)))) { 3.410 - return -1; 3.411 - } 3.412 - if (jas_stream_read(in, colr->iccp, colr->iccplen) != colr->iccplen) { 3.413 -@@ -453,7 +453,7 @@ 3.414 - if (jp2_getuint16(in, &cdef->numchans)) { 3.415 - return -1; 3.416 - } 3.417 -- if (!(cdef->ents = jas_malloc(cdef->numchans * sizeof(jp2_cdefchan_t)))) { 3.418 -+ if (!(cdef->ents = jas_alloc2(cdef->numchans, sizeof(jp2_cdefchan_t)))) { 3.419 - return -1; 3.420 - } 3.421 - for (channo = 0; channo < cdef->numchans; ++channo) { 3.422 -@@ -766,7 +766,7 @@ 3.423 - unsigned int i; 3.424 - 3.425 - cmap->numchans = (box->datalen) / 4; 3.426 -- if (!(cmap->ents = jas_malloc(cmap->numchans * sizeof(jp2_cmapent_t)))) { 3.427 -+ if (!(cmap->ents = jas_alloc2(cmap->numchans, sizeof(jp2_cmapent_t)))) { 3.428 - return -1; 3.429 - } 3.430 - for (i = 0; i < cmap->numchans; ++i) { 3.431 -@@ -828,10 +828,10 @@ 3.432 - return -1; 3.433 - } 3.434 - lutsize = pclr->numlutents * pclr->numchans; 3.435 -- if (!(pclr->lutdata = jas_malloc(lutsize * sizeof(int_fast32_t)))) { 3.436 -+ if (!(pclr->lutdata = jas_alloc2(lutsize, sizeof(int_fast32_t)))) { 3.437 - return -1; 3.438 - } 3.439 -- if (!(pclr->bpc = jas_malloc(pclr->numchans * sizeof(uint_fast8_t)))) { 3.440 -+ if (!(pclr->bpc = jas_alloc2(pclr->numchans, sizeof(uint_fast8_t)))) { 3.441 - return -1; 3.442 - } 3.443 - for (i = 0; i < pclr->numchans; ++i) { 3.444 ---- a/src/libjasper/jp2/jp2_dec.c 2007-01-19 22:43:05.000000000 +0100 3.445 -+++ b/src/libjasper/jp2/jp2_dec.c 2015-01-28 18:01:07.082617636 +0100 3.446 -@@ -291,7 +291,10 @@ 3.447 - case JP2_COLR_ICC: 3.448 - iccprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp, 3.449 - dec->colr->data.colr.iccplen); 3.450 -- assert(iccprof); 3.451 -+ if (!iccprof) { 3.452 -+ jas_eprintf("error: failed to parse ICC profile\n"); 3.453 -+ goto error; 3.454 -+ } 3.455 - jas_iccprof_gethdr(iccprof, &icchdr); 3.456 - jas_eprintf("ICC Profile CS %08x\n", icchdr.colorspc); 3.457 - jas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc)); 3.458 -@@ -336,7 +339,7 @@ 3.459 - } 3.460 - 3.461 - /* Allocate space for the channel-number to component-number LUT. */ 3.462 -- if (!(dec->chantocmptlut = jas_malloc(dec->numchans * sizeof(uint_fast16_t)))) { 3.463 -+ if (!(dec->chantocmptlut = jas_alloc2(dec->numchans, sizeof(uint_fast16_t)))) { 3.464 - jas_eprintf("error: no memory\n"); 3.465 - goto error; 3.466 - } 3.467 -@@ -354,7 +357,7 @@ 3.468 - if (cmapent->map == JP2_CMAP_DIRECT) { 3.469 - dec->chantocmptlut[channo] = channo; 3.470 - } else if (cmapent->map == JP2_CMAP_PALETTE) { 3.471 -- lutents = jas_malloc(pclrd->numlutents * sizeof(int_fast32_t)); 3.472 -+ lutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t)); 3.473 - for (i = 0; i < pclrd->numlutents; ++i) { 3.474 - lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans]; 3.475 - } 3.476 -@@ -386,6 +389,11 @@ 3.477 - /* Determine the type of each component. */ 3.478 - if (dec->cdef) { 3.479 - for (i = 0; i < dec->numchans; ++i) { 3.480 -+ /* Is the channel number reasonable? */ 3.481 -+ if (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) { 3.482 -+ jas_eprintf("error: invalid channel number in CDEF box\n"); 3.483 -+ goto error; 3.484 -+ } 3.485 - jas_image_setcmpttype(dec->image, 3.486 - dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo], 3.487 - jp2_getct(jas_image_clrspc(dec->image), 3.488 ---- a/src/libjasper/jp2/jp2_enc.c 2007-01-19 22:43:05.000000000 +0100 3.489 -+++ b/src/libjasper/jp2/jp2_enc.c 2015-01-28 17:57:34.119045453 +0100 3.490 -@@ -191,7 +191,7 @@ 3.491 - } 3.492 - bpcc = &box->data.bpcc; 3.493 - bpcc->numcmpts = jas_image_numcmpts(image); 3.494 -- if (!(bpcc->bpcs = jas_malloc(bpcc->numcmpts * 3.495 -+ if (!(bpcc->bpcs = jas_alloc2(bpcc->numcmpts, 3.496 - sizeof(uint_fast8_t)))) { 3.497 - goto error; 3.498 - } 3.499 -@@ -285,7 +285,7 @@ 3.500 - } 3.501 - cdef = &box->data.cdef; 3.502 - cdef->numchans = jas_image_numcmpts(image); 3.503 -- cdef->ents = jas_malloc(cdef->numchans * sizeof(jp2_cdefchan_t)); 3.504 -+ cdef->ents = jas_alloc2(cdef->numchans, sizeof(jp2_cdefchan_t)); 3.505 - for (i = 0; i < jas_image_numcmpts(image); ++i) { 3.506 - cdefchanent = &cdef->ents[i]; 3.507 - cdefchanent->channo = i; 3.508 ---- a/src/libjasper/jpc/jpc_cs.c 2007-01-19 22:43:07.000000000 +0100 3.509 -+++ b/src/libjasper/jpc/jpc_cs.c 2015-01-28 17:57:34.120045470 +0100 3.510 -@@ -502,7 +502,7 @@ 3.511 - !siz->tileheight || !siz->numcomps) { 3.512 - return -1; 3.513 - } 3.514 -- if (!(siz->comps = jas_malloc(siz->numcomps * sizeof(jpc_sizcomp_t)))) { 3.515 -+ if (!(siz->comps = jas_alloc2(siz->numcomps, sizeof(jpc_sizcomp_t)))) { 3.516 - return -1; 3.517 - } 3.518 - for (i = 0; i < siz->numcomps; ++i) { 3.519 -@@ -982,8 +982,11 @@ 3.520 - compparms->numstepsizes = (len - n) / 2; 3.521 - break; 3.522 - } 3.523 -- if (compparms->numstepsizes > 0) { 3.524 -- compparms->stepsizes = jas_malloc(compparms->numstepsizes * 3.525 -+ if (compparms->numstepsizes > 3 * JPC_MAXRLVLS + 1) { 3.526 -+ jpc_qcx_destroycompparms(compparms); 3.527 -+ return -1; 3.528 -+ } else if (compparms->numstepsizes > 0) { 3.529 -+ compparms->stepsizes = jas_alloc2(compparms->numstepsizes, 3.530 - sizeof(uint_fast16_t)); 3.531 - assert(compparms->stepsizes); 3.532 - for (i = 0; i < compparms->numstepsizes; ++i) { 3.533 -@@ -1091,7 +1094,7 @@ 3.534 - 3.535 - ppm->len = ms->len - 1; 3.536 - if (ppm->len > 0) { 3.537 -- if (!(ppm->data = jas_malloc(ppm->len * sizeof(unsigned char)))) { 3.538 -+ if (!(ppm->data = jas_malloc(ppm->len))) { 3.539 - goto error; 3.540 - } 3.541 - if (JAS_CAST(uint, jas_stream_read(in, ppm->data, ppm->len)) != ppm->len) { 3.542 -@@ -1160,7 +1163,7 @@ 3.543 - } 3.544 - ppt->len = ms->len - 1; 3.545 - if (ppt->len > 0) { 3.546 -- if (!(ppt->data = jas_malloc(ppt->len * sizeof(unsigned char)))) { 3.547 -+ if (!(ppt->data = jas_malloc(ppt->len))) { 3.548 - goto error; 3.549 - } 3.550 - if (jas_stream_read(in, (char *) ppt->data, ppt->len) != JAS_CAST(int, ppt->len)) { 3.551 -@@ -1223,7 +1226,7 @@ 3.552 - uint_fast8_t tmp; 3.553 - poc->numpchgs = (cstate->numcomps > 256) ? (ms->len / 9) : 3.554 - (ms->len / 7); 3.555 -- if (!(poc->pchgs = jas_malloc(poc->numpchgs * sizeof(jpc_pocpchg_t)))) { 3.556 -+ if (!(poc->pchgs = jas_alloc2(poc->numpchgs, sizeof(jpc_pocpchg_t)))) { 3.557 - goto error; 3.558 - } 3.559 - for (pchgno = 0, pchg = poc->pchgs; pchgno < poc->numpchgs; ++pchgno, 3.560 -@@ -1328,7 +1331,7 @@ 3.561 - jpc_crgcomp_t *comp; 3.562 - uint_fast16_t compno; 3.563 - crg->numcomps = cstate->numcomps; 3.564 -- if (!(crg->comps = jas_malloc(cstate->numcomps * sizeof(uint_fast16_t)))) { 3.565 -+ if (!(crg->comps = jas_alloc2(cstate->numcomps, sizeof(uint_fast16_t)))) { 3.566 - return -1; 3.567 - } 3.568 - for (compno = 0, comp = crg->comps; compno < cstate->numcomps; 3.569 -@@ -1467,7 +1470,7 @@ 3.570 - cstate = 0; 3.571 - 3.572 - if (ms->len > 0) { 3.573 -- if (!(unk->data = jas_malloc(ms->len * sizeof(unsigned char)))) { 3.574 -+ if (!(unk->data = jas_malloc(ms->len))) { 3.575 - return -1; 3.576 - } 3.577 - if (jas_stream_read(in, (char *) unk->data, ms->len) != JAS_CAST(int, ms->len)) { 3.578 ---- a/src/libjasper/jpc/jpc_dec.c 2007-01-19 22:43:07.000000000 +0100 3.579 -+++ b/src/libjasper/jpc/jpc_dec.c 2015-01-28 17:59:44.748230228 +0100 3.580 -@@ -449,7 +449,7 @@ 3.581 - 3.582 - if (dec->state == JPC_MH) { 3.583 - 3.584 -- compinfos = jas_malloc(dec->numcomps * sizeof(jas_image_cmptparm_t)); 3.585 -+ compinfos = jas_alloc2(dec->numcomps, sizeof(jas_image_cmptparm_t)); 3.586 - assert(compinfos); 3.587 - for (cmptno = 0, cmpt = dec->cmpts, compinfo = compinfos; 3.588 - cmptno < dec->numcomps; ++cmptno, ++cmpt, ++compinfo) { 3.589 -@@ -489,7 +489,7 @@ 3.590 - dec->curtileendoff = 0; 3.591 - } 3.592 - 3.593 -- if (JAS_CAST(int, sot->tileno) > dec->numtiles) { 3.594 -+ if (JAS_CAST(int, sot->tileno) >= dec->numtiles) { 3.595 - jas_eprintf("invalid tile number in SOT marker segment\n"); 3.596 - return -1; 3.597 - } 3.598 -@@ -692,7 +692,7 @@ 3.599 - tile->realmode = 1; 3.600 - } 3.601 - tcomp->numrlvls = ccp->numrlvls; 3.602 -- if (!(tcomp->rlvls = jas_malloc(tcomp->numrlvls * 3.603 -+ if (!(tcomp->rlvls = jas_alloc2(tcomp->numrlvls, 3.604 - sizeof(jpc_dec_rlvl_t)))) { 3.605 - return -1; 3.606 - } 3.607 -@@ -764,7 +764,7 @@ 3.608 - rlvl->cbgheightexpn); 3.609 - 3.610 - rlvl->numbands = (!rlvlno) ? 1 : 3; 3.611 -- if (!(rlvl->bands = jas_malloc(rlvl->numbands * 3.612 -+ if (!(rlvl->bands = jas_alloc2(rlvl->numbands, 3.613 - sizeof(jpc_dec_band_t)))) { 3.614 - return -1; 3.615 - } 3.616 -@@ -797,7 +797,7 @@ 3.617 - 3.618 - assert(rlvl->numprcs); 3.619 - 3.620 -- if (!(band->prcs = jas_malloc(rlvl->numprcs * sizeof(jpc_dec_prc_t)))) { 3.621 -+ if (!(band->prcs = jas_alloc2(rlvl->numprcs, sizeof(jpc_dec_prc_t)))) { 3.622 - return -1; 3.623 - } 3.624 - 3.625 -@@ -834,7 +834,7 @@ 3.626 - if (!(prc->numimsbstagtree = jpc_tagtree_create(prc->numhcblks, prc->numvcblks))) { 3.627 - return -1; 3.628 - } 3.629 -- if (!(prc->cblks = jas_malloc(prc->numcblks * sizeof(jpc_dec_cblk_t)))) { 3.630 -+ if (!(prc->cblks = jas_alloc2(prc->numcblks, sizeof(jpc_dec_cblk_t)))) { 3.631 - return -1; 3.632 - } 3.633 - 3.634 -@@ -1069,12 +1069,12 @@ 3.635 - /* Apply an inverse intercomponent transform if necessary. */ 3.636 - switch (tile->cp->mctid) { 3.637 - case JPC_MCT_RCT: 3.638 -- assert(dec->numcomps == 3); 3.639 -+ assert(dec->numcomps >= 3); 3.640 - jpc_irct(tile->tcomps[0].data, tile->tcomps[1].data, 3.641 - tile->tcomps[2].data); 3.642 - break; 3.643 - case JPC_MCT_ICT: 3.644 -- assert(dec->numcomps == 3); 3.645 -+ assert(dec->numcomps >= 3); 3.646 - jpc_iict(tile->tcomps[0].data, tile->tcomps[1].data, 3.647 - tile->tcomps[2].data); 3.648 - break; 3.649 -@@ -1181,7 +1181,7 @@ 3.650 - return -1; 3.651 - } 3.652 - 3.653 -- if (!(dec->cmpts = jas_malloc(dec->numcomps * sizeof(jpc_dec_cmpt_t)))) { 3.654 -+ if (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) { 3.655 - return -1; 3.656 - } 3.657 - 3.658 -@@ -1204,7 +1204,7 @@ 3.659 - dec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth); 3.660 - dec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight); 3.661 - dec->numtiles = dec->numhtiles * dec->numvtiles; 3.662 -- if (!(dec->tiles = jas_malloc(dec->numtiles * sizeof(jpc_dec_tile_t)))) { 3.663 -+ if (!(dec->tiles = jas_calloc(dec->numtiles, sizeof(jpc_dec_tile_t)))) { 3.664 - return -1; 3.665 - } 3.666 - 3.667 -@@ -1228,7 +1228,7 @@ 3.668 - tile->pkthdrstreampos = 0; 3.669 - tile->pptstab = 0; 3.670 - tile->cp = 0; 3.671 -- if (!(tile->tcomps = jas_malloc(dec->numcomps * 3.672 -+ if (!(tile->tcomps = jas_calloc(dec->numcomps, 3.673 - sizeof(jpc_dec_tcomp_t)))) { 3.674 - return -1; 3.675 - } 3.676 -@@ -1280,7 +1280,7 @@ 3.677 - jpc_coc_t *coc = &ms->parms.coc; 3.678 - jpc_dec_tile_t *tile; 3.679 - 3.680 -- if (JAS_CAST(int, coc->compno) > dec->numcomps) { 3.681 -+ if (JAS_CAST(int, coc->compno) >= dec->numcomps) { 3.682 - jas_eprintf("invalid component number in COC marker segment\n"); 3.683 - return -1; 3.684 - } 3.685 -@@ -1306,7 +1306,7 @@ 3.686 - jpc_rgn_t *rgn = &ms->parms.rgn; 3.687 - jpc_dec_tile_t *tile; 3.688 - 3.689 -- if (JAS_CAST(int, rgn->compno) > dec->numcomps) { 3.690 -+ if (JAS_CAST(int, rgn->compno) >= dec->numcomps) { 3.691 - jas_eprintf("invalid component number in RGN marker segment\n"); 3.692 - return -1; 3.693 - } 3.694 -@@ -1355,7 +1355,7 @@ 3.695 - jpc_qcc_t *qcc = &ms->parms.qcc; 3.696 - jpc_dec_tile_t *tile; 3.697 - 3.698 -- if (JAS_CAST(int, qcc->compno) > dec->numcomps) { 3.699 -+ if (JAS_CAST(int, qcc->compno) >= dec->numcomps) { 3.700 - jas_eprintf("invalid component number in QCC marker segment\n"); 3.701 - return -1; 3.702 - } 3.703 -@@ -1489,7 +1489,7 @@ 3.704 - cp->numlyrs = 0; 3.705 - cp->mctid = 0; 3.706 - cp->csty = 0; 3.707 -- if (!(cp->ccps = jas_malloc(cp->numcomps * sizeof(jpc_dec_ccp_t)))) { 3.708 -+ if (!(cp->ccps = jas_alloc2(cp->numcomps, sizeof(jpc_dec_ccp_t)))) { 3.709 - return 0; 3.710 - } 3.711 - if (!(cp->pchglist = jpc_pchglist_create())) { 3.712 -@@ -2048,7 +2048,7 @@ 3.713 - } 3.714 - streamlist->numstreams = 0; 3.715 - streamlist->maxstreams = 100; 3.716 -- if (!(streamlist->streams = jas_malloc(streamlist->maxstreams * 3.717 -+ if (!(streamlist->streams = jas_alloc2(streamlist->maxstreams, 3.718 - sizeof(jas_stream_t *)))) { 3.719 - jas_free(streamlist); 3.720 - return 0; 3.721 -@@ -2068,8 +2068,8 @@ 3.722 - /* Grow the array of streams if necessary. */ 3.723 - if (streamlist->numstreams >= streamlist->maxstreams) { 3.724 - newmaxstreams = streamlist->maxstreams + 1024; 3.725 -- if (!(newstreams = jas_realloc(streamlist->streams, 3.726 -- (newmaxstreams + 1024) * sizeof(jas_stream_t *)))) { 3.727 -+ if (!(newstreams = jas_realloc2(streamlist->streams, 3.728 -+ (newmaxstreams + 1024), sizeof(jas_stream_t *)))) { 3.729 - return -1; 3.730 - } 3.731 - for (i = streamlist->numstreams; i < streamlist->maxstreams; ++i) { 3.732 -@@ -2155,8 +2155,7 @@ 3.733 - { 3.734 - jpc_ppxstabent_t **newents; 3.735 - if (tab->maxents < maxents) { 3.736 -- newents = (tab->ents) ? jas_realloc(tab->ents, maxents * 3.737 -- sizeof(jpc_ppxstabent_t *)) : jas_malloc(maxents * sizeof(jpc_ppxstabent_t *)); 3.738 -+ newents = jas_realloc2(tab->ents, maxents, sizeof(jpc_ppxstabent_t *)); 3.739 - if (!newents) { 3.740 - return -1; 3.741 - } 3.742 ---- a/src/libjasper/jpc/jpc_enc.c 2007-01-19 22:43:07.000000000 +0100 3.743 -+++ b/src/libjasper/jpc/jpc_enc.c 2015-01-28 17:57:34.122045503 +0100 3.744 -@@ -403,7 +403,7 @@ 3.745 - vsteplcm *= jas_image_cmptvstep(image, cmptno); 3.746 - } 3.747 - 3.748 -- if (!(cp->ccps = jas_malloc(cp->numcmpts * sizeof(jpc_enc_ccp_t)))) { 3.749 -+ if (!(cp->ccps = jas_alloc2(cp->numcmpts, sizeof(jpc_enc_ccp_t)))) { 3.750 - goto error; 3.751 - } 3.752 - for (cmptno = 0, ccp = cp->ccps; cmptno < JAS_CAST(int, cp->numcmpts); ++cmptno, 3.753 -@@ -656,7 +656,7 @@ 3.754 - 3.755 - if (ilyrrates && numilyrrates > 0) { 3.756 - tcp->numlyrs = numilyrrates + 1; 3.757 -- if (!(tcp->ilyrrates = jas_malloc((tcp->numlyrs - 1) * 3.758 -+ if (!(tcp->ilyrrates = jas_alloc2((tcp->numlyrs - 1), 3.759 - sizeof(jpc_fix_t)))) { 3.760 - goto error; 3.761 - } 3.762 -@@ -940,7 +940,7 @@ 3.763 - siz->tilewidth = cp->tilewidth; 3.764 - siz->tileheight = cp->tileheight; 3.765 - siz->numcomps = cp->numcmpts; 3.766 -- siz->comps = jas_malloc(siz->numcomps * sizeof(jpc_sizcomp_t)); 3.767 -+ siz->comps = jas_alloc2(siz->numcomps, sizeof(jpc_sizcomp_t)); 3.768 - assert(siz->comps); 3.769 - for (i = 0; i < JAS_CAST(int, cp->numcmpts); ++i) { 3.770 - siz->comps[i].prec = cp->ccps[i].prec; 3.771 -@@ -977,7 +977,7 @@ 3.772 - return -1; 3.773 - } 3.774 - crg = &enc->mrk->parms.crg; 3.775 -- crg->comps = jas_malloc(crg->numcomps * sizeof(jpc_crgcomp_t)); 3.776 -+ crg->comps = jas_alloc2(crg->numcomps, sizeof(jpc_crgcomp_t)); 3.777 - if (jpc_putms(enc->out, enc->cstate, enc->mrk)) { 3.778 - jas_eprintf("cannot write CRG marker\n"); 3.779 - return -1; 3.780 -@@ -1955,7 +1955,7 @@ 3.781 - tile->mctid = cp->tcp.mctid; 3.782 - 3.783 - tile->numlyrs = cp->tcp.numlyrs; 3.784 -- if (!(tile->lyrsizes = jas_malloc(tile->numlyrs * 3.785 -+ if (!(tile->lyrsizes = jas_alloc2(tile->numlyrs, 3.786 - sizeof(uint_fast32_t)))) { 3.787 - goto error; 3.788 - } 3.789 -@@ -1964,7 +1964,7 @@ 3.790 - } 3.791 - 3.792 - /* Allocate an array for the per-tile-component information. */ 3.793 -- if (!(tile->tcmpts = jas_malloc(cp->numcmpts * sizeof(jpc_enc_tcmpt_t)))) { 3.794 -+ if (!(tile->tcmpts = jas_alloc2(cp->numcmpts, sizeof(jpc_enc_tcmpt_t)))) { 3.795 - goto error; 3.796 - } 3.797 - /* Initialize a few members critical for error recovery. */ 3.798 -@@ -2110,7 +2110,7 @@ 3.799 - jas_seq2d_ystart(tcmpt->data), jas_seq2d_xend(tcmpt->data), 3.800 - jas_seq2d_yend(tcmpt->data), bandinfos); 3.801 - 3.802 -- if (!(tcmpt->rlvls = jas_malloc(tcmpt->numrlvls * sizeof(jpc_enc_rlvl_t)))) { 3.803 -+ if (!(tcmpt->rlvls = jas_alloc2(tcmpt->numrlvls, sizeof(jpc_enc_rlvl_t)))) { 3.804 - goto error; 3.805 - } 3.806 - for (rlvlno = 0, rlvl = tcmpt->rlvls; rlvlno < tcmpt->numrlvls; 3.807 -@@ -2213,7 +2213,7 @@ 3.808 - rlvl->numvprcs = JPC_FLOORDIVPOW2(brprcbry - tlprctly, rlvl->prcheightexpn); 3.809 - rlvl->numprcs = rlvl->numhprcs * rlvl->numvprcs; 3.810 - 3.811 -- if (!(rlvl->bands = jas_malloc(rlvl->numbands * sizeof(jpc_enc_band_t)))) { 3.812 -+ if (!(rlvl->bands = jas_alloc2(rlvl->numbands, sizeof(jpc_enc_band_t)))) { 3.813 - goto error; 3.814 - } 3.815 - for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands; 3.816 -@@ -2290,7 +2290,7 @@ 3.817 - band->synweight = bandinfo->synenergywt; 3.818 - 3.819 - if (band->data) { 3.820 -- if (!(band->prcs = jas_malloc(rlvl->numprcs * sizeof(jpc_enc_prc_t)))) { 3.821 -+ if (!(band->prcs = jas_alloc2(rlvl->numprcs, sizeof(jpc_enc_prc_t)))) { 3.822 - goto error; 3.823 - } 3.824 - for (prcno = 0, prc = band->prcs; prcno < rlvl->numprcs; ++prcno, 3.825 -@@ -2422,7 +2422,7 @@ 3.826 - goto error; 3.827 - } 3.828 - 3.829 -- if (!(prc->cblks = jas_malloc(prc->numcblks * sizeof(jpc_enc_cblk_t)))) { 3.830 -+ if (!(prc->cblks = jas_alloc2(prc->numcblks, sizeof(jpc_enc_cblk_t)))) { 3.831 - goto error; 3.832 - } 3.833 - for (cblkno = 0, cblk = prc->cblks; cblkno < prc->numcblks; 3.834 ---- a/src/libjasper/jpc/jpc_mqdec.c 2007-01-19 22:43:07.000000000 +0100 3.835 -+++ b/src/libjasper/jpc/jpc_mqdec.c 2015-01-28 17:57:34.126045570 +0100 3.836 -@@ -118,7 +118,7 @@ 3.837 - mqdec->in = in; 3.838 - mqdec->maxctxs = maxctxs; 3.839 - /* Allocate memory for the per-context state information. */ 3.840 -- if (!(mqdec->ctxs = jas_malloc(mqdec->maxctxs * sizeof(jpc_mqstate_t *)))) { 3.841 -+ if (!(mqdec->ctxs = jas_alloc2(mqdec->maxctxs, sizeof(jpc_mqstate_t *)))) { 3.842 - goto error; 3.843 - } 3.844 - /* Set the current context to the first context. */ 3.845 ---- a/src/libjasper/jpc/jpc_mqenc.c 2007-01-19 22:43:07.000000000 +0100 3.846 -+++ b/src/libjasper/jpc/jpc_mqenc.c 2015-01-28 17:57:34.126045570 +0100 3.847 -@@ -197,7 +197,7 @@ 3.848 - mqenc->maxctxs = maxctxs; 3.849 - 3.850 - /* Allocate memory for the per-context state information. */ 3.851 -- if (!(mqenc->ctxs = jas_malloc(mqenc->maxctxs * sizeof(jpc_mqstate_t *)))) { 3.852 -+ if (!(mqenc->ctxs = jas_alloc2(mqenc->maxctxs, sizeof(jpc_mqstate_t *)))) { 3.853 - goto error; 3.854 - } 3.855 - 3.856 ---- a/src/libjasper/jpc/jpc_qmfb.c 2007-01-19 22:43:07.000000000 +0100 3.857 -+++ b/src/libjasper/jpc/jpc_qmfb.c 2015-01-28 18:00:17.753785538 +0100 3.858 -@@ -306,11 +306,7 @@ 3.859 - { 3.860 - 3.861 - int bufsize = JPC_CEILDIVPOW2(numcols, 1); 3.862 --#if !defined(HAVE_VLA) 3.863 - jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; 3.864 --#else 3.865 -- jpc_fix_t splitbuf[bufsize]; 3.866 --#endif 3.867 - jpc_fix_t *buf = splitbuf; 3.868 - register jpc_fix_t *srcptr; 3.869 - register jpc_fix_t *dstptr; 3.870 -@@ -318,15 +314,13 @@ 3.871 - register int m; 3.872 - int hstartcol; 3.873 - 3.874 --#if !defined(HAVE_VLA) 3.875 - /* Get a buffer. */ 3.876 - if (bufsize > QMFB_SPLITBUFSIZE) { 3.877 -- if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { 3.878 -+ if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 3.879 - /* We have no choice but to commit suicide in this case. */ 3.880 - abort(); 3.881 - } 3.882 - } 3.883 --#endif 3.884 - 3.885 - if (numcols >= 2) { 3.886 - hstartcol = (numcols + 1 - parity) >> 1; 3.887 -@@ -360,12 +354,10 @@ 3.888 - } 3.889 - } 3.890 - 3.891 --#if !defined(HAVE_VLA) 3.892 - /* If the split buffer was allocated on the heap, free this memory. */ 3.893 - if (buf != splitbuf) { 3.894 - jas_free(buf); 3.895 - } 3.896 --#endif 3.897 - 3.898 - } 3.899 - 3.900 -@@ -374,11 +366,7 @@ 3.901 - { 3.902 - 3.903 - int bufsize = JPC_CEILDIVPOW2(numrows, 1); 3.904 --#if !defined(HAVE_VLA) 3.905 - jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; 3.906 --#else 3.907 -- jpc_fix_t splitbuf[bufsize]; 3.908 --#endif 3.909 - jpc_fix_t *buf = splitbuf; 3.910 - register jpc_fix_t *srcptr; 3.911 - register jpc_fix_t *dstptr; 3.912 -@@ -386,15 +374,13 @@ 3.913 - register int m; 3.914 - int hstartcol; 3.915 - 3.916 --#if !defined(HAVE_VLA) 3.917 - /* Get a buffer. */ 3.918 - if (bufsize > QMFB_SPLITBUFSIZE) { 3.919 -- if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { 3.920 -+ if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 3.921 - /* We have no choice but to commit suicide in this case. */ 3.922 - abort(); 3.923 - } 3.924 - } 3.925 --#endif 3.926 - 3.927 - if (numrows >= 2) { 3.928 - hstartcol = (numrows + 1 - parity) >> 1; 3.929 -@@ -428,12 +414,10 @@ 3.930 - } 3.931 - } 3.932 - 3.933 --#if !defined(HAVE_VLA) 3.934 - /* If the split buffer was allocated on the heap, free this memory. */ 3.935 - if (buf != splitbuf) { 3.936 - jas_free(buf); 3.937 - } 3.938 --#endif 3.939 - 3.940 - } 3.941 - 3.942 -@@ -442,11 +426,7 @@ 3.943 - { 3.944 - 3.945 - int bufsize = JPC_CEILDIVPOW2(numrows, 1); 3.946 --#if !defined(HAVE_VLA) 3.947 - jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE]; 3.948 --#else 3.949 -- jpc_fix_t splitbuf[bufsize * JPC_QMFB_COLGRPSIZE]; 3.950 --#endif 3.951 - jpc_fix_t *buf = splitbuf; 3.952 - jpc_fix_t *srcptr; 3.953 - jpc_fix_t *dstptr; 3.954 -@@ -457,15 +437,13 @@ 3.955 - int m; 3.956 - int hstartcol; 3.957 - 3.958 --#if !defined(HAVE_VLA) 3.959 - /* Get a buffer. */ 3.960 - if (bufsize > QMFB_SPLITBUFSIZE) { 3.961 -- if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { 3.962 -+ if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 3.963 - /* We have no choice but to commit suicide in this case. */ 3.964 - abort(); 3.965 - } 3.966 - } 3.967 --#endif 3.968 - 3.969 - if (numrows >= 2) { 3.970 - hstartcol = (numrows + 1 - parity) >> 1; 3.971 -@@ -517,12 +495,10 @@ 3.972 - } 3.973 - } 3.974 - 3.975 --#if !defined(HAVE_VLA) 3.976 - /* If the split buffer was allocated on the heap, free this memory. */ 3.977 - if (buf != splitbuf) { 3.978 - jas_free(buf); 3.979 - } 3.980 --#endif 3.981 - 3.982 - } 3.983 - 3.984 -@@ -531,11 +507,7 @@ 3.985 - { 3.986 - 3.987 - int bufsize = JPC_CEILDIVPOW2(numrows, 1); 3.988 --#if !defined(HAVE_VLA) 3.989 - jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE]; 3.990 --#else 3.991 -- jpc_fix_t splitbuf[bufsize * numcols]; 3.992 --#endif 3.993 - jpc_fix_t *buf = splitbuf; 3.994 - jpc_fix_t *srcptr; 3.995 - jpc_fix_t *dstptr; 3.996 -@@ -546,15 +518,13 @@ 3.997 - int m; 3.998 - int hstartcol; 3.999 - 3.1000 --#if !defined(HAVE_VLA) 3.1001 - /* Get a buffer. */ 3.1002 - if (bufsize > QMFB_SPLITBUFSIZE) { 3.1003 -- if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { 3.1004 -+ if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 3.1005 - /* We have no choice but to commit suicide in this case. */ 3.1006 - abort(); 3.1007 - } 3.1008 - } 3.1009 --#endif 3.1010 - 3.1011 - if (numrows >= 2) { 3.1012 - hstartcol = (numrows + 1 - parity) >> 1; 3.1013 -@@ -606,12 +576,10 @@ 3.1014 - } 3.1015 - } 3.1016 - 3.1017 --#if !defined(HAVE_VLA) 3.1018 - /* If the split buffer was allocated on the heap, free this memory. */ 3.1019 - if (buf != splitbuf) { 3.1020 - jas_free(buf); 3.1021 - } 3.1022 --#endif 3.1023 - 3.1024 - } 3.1025 - 3.1026 -@@ -619,26 +587,20 @@ 3.1027 - { 3.1028 - 3.1029 - int bufsize = JPC_CEILDIVPOW2(numcols, 1); 3.1030 --#if !defined(HAVE_VLA) 3.1031 - jpc_fix_t joinbuf[QMFB_JOINBUFSIZE]; 3.1032 --#else 3.1033 -- jpc_fix_t joinbuf[bufsize]; 3.1034 --#endif 3.1035 - jpc_fix_t *buf = joinbuf; 3.1036 - register jpc_fix_t *srcptr; 3.1037 - register jpc_fix_t *dstptr; 3.1038 - register int n; 3.1039 - int hstartcol; 3.1040 - 3.1041 --#if !defined(HAVE_VLA) 3.1042 - /* Allocate memory for the join buffer from the heap. */ 3.1043 - if (bufsize > QMFB_JOINBUFSIZE) { 3.1044 -- if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { 3.1045 -+ if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 3.1046 - /* We have no choice but to commit suicide. */ 3.1047 - abort(); 3.1048 - } 3.1049 - } 3.1050 --#endif 3.1051 - 3.1052 - hstartcol = (numcols + 1 - parity) >> 1; 3.1053 - 3.1054 -@@ -670,12 +632,10 @@ 3.1055 - ++srcptr; 3.1056 - } 3.1057 - 3.1058 --#if !defined(HAVE_VLA) 3.1059 - /* If the join buffer was allocated on the heap, free this memory. */ 3.1060 - if (buf != joinbuf) { 3.1061 - jas_free(buf); 3.1062 - } 3.1063 --#endif 3.1064 - 3.1065 - } 3.1066 - 3.1067 -@@ -684,26 +644,20 @@ 3.1068 - { 3.1069 - 3.1070 - int bufsize = JPC_CEILDIVPOW2(numrows, 1); 3.1071 --#if !defined(HAVE_VLA) 3.1072 - jpc_fix_t joinbuf[QMFB_JOINBUFSIZE]; 3.1073 --#else 3.1074 -- jpc_fix_t joinbuf[bufsize]; 3.1075 --#endif 3.1076 - jpc_fix_t *buf = joinbuf; 3.1077 - register jpc_fix_t *srcptr; 3.1078 - register jpc_fix_t *dstptr; 3.1079 - register int n; 3.1080 - int hstartcol; 3.1081 - 3.1082 --#if !defined(HAVE_VLA) 3.1083 - /* Allocate memory for the join buffer from the heap. */ 3.1084 - if (bufsize > QMFB_JOINBUFSIZE) { 3.1085 -- if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { 3.1086 -+ if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 3.1087 - /* We have no choice but to commit suicide. */ 3.1088 - abort(); 3.1089 - } 3.1090 - } 3.1091 --#endif 3.1092 - 3.1093 - hstartcol = (numrows + 1 - parity) >> 1; 3.1094 - 3.1095 -@@ -735,12 +689,10 @@ 3.1096 - ++srcptr; 3.1097 - } 3.1098 - 3.1099 --#if !defined(HAVE_VLA) 3.1100 - /* If the join buffer was allocated on the heap, free this memory. */ 3.1101 - if (buf != joinbuf) { 3.1102 - jas_free(buf); 3.1103 - } 3.1104 --#endif 3.1105 - 3.1106 - } 3.1107 - 3.1108 -@@ -749,11 +701,7 @@ 3.1109 - { 3.1110 - 3.1111 - int bufsize = JPC_CEILDIVPOW2(numrows, 1); 3.1112 --#if !defined(HAVE_VLA) 3.1113 - jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE]; 3.1114 --#else 3.1115 -- jpc_fix_t joinbuf[bufsize * JPC_QMFB_COLGRPSIZE]; 3.1116 --#endif 3.1117 - jpc_fix_t *buf = joinbuf; 3.1118 - jpc_fix_t *srcptr; 3.1119 - jpc_fix_t *dstptr; 3.1120 -@@ -763,15 +711,13 @@ 3.1121 - register int i; 3.1122 - int hstartcol; 3.1123 - 3.1124 --#if !defined(HAVE_VLA) 3.1125 - /* Allocate memory for the join buffer from the heap. */ 3.1126 - if (bufsize > QMFB_JOINBUFSIZE) { 3.1127 -- if (!(buf = jas_malloc(bufsize * JPC_QMFB_COLGRPSIZE * sizeof(jpc_fix_t)))) { 3.1128 -+ if (!(buf = jas_alloc2(bufsize, JPC_QMFB_COLGRPSIZE * sizeof(jpc_fix_t)))) { 3.1129 - /* We have no choice but to commit suicide. */ 3.1130 - abort(); 3.1131 - } 3.1132 - } 3.1133 --#endif 3.1134 - 3.1135 - hstartcol = (numrows + 1 - parity) >> 1; 3.1136 - 3.1137 -@@ -821,12 +767,10 @@ 3.1138 - srcptr += JPC_QMFB_COLGRPSIZE; 3.1139 - } 3.1140 - 3.1141 --#if !defined(HAVE_VLA) 3.1142 - /* If the join buffer was allocated on the heap, free this memory. */ 3.1143 - if (buf != joinbuf) { 3.1144 - jas_free(buf); 3.1145 - } 3.1146 --#endif 3.1147 - 3.1148 - } 3.1149 - 3.1150 -@@ -835,11 +779,7 @@ 3.1151 - { 3.1152 - 3.1153 - int bufsize = JPC_CEILDIVPOW2(numrows, 1); 3.1154 --#if !defined(HAVE_VLA) 3.1155 - jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE]; 3.1156 --#else 3.1157 -- jpc_fix_t joinbuf[bufsize * numcols]; 3.1158 --#endif 3.1159 - jpc_fix_t *buf = joinbuf; 3.1160 - jpc_fix_t *srcptr; 3.1161 - jpc_fix_t *dstptr; 3.1162 -@@ -849,15 +789,13 @@ 3.1163 - register int i; 3.1164 - int hstartcol; 3.1165 - 3.1166 --#if !defined(HAVE_VLA) 3.1167 - /* Allocate memory for the join buffer from the heap. */ 3.1168 - if (bufsize > QMFB_JOINBUFSIZE) { 3.1169 -- if (!(buf = jas_malloc(bufsize * numcols * sizeof(jpc_fix_t)))) { 3.1170 -+ if (!(buf = jas_alloc3(bufsize, numcols, sizeof(jpc_fix_t)))) { 3.1171 - /* We have no choice but to commit suicide. */ 3.1172 - abort(); 3.1173 - } 3.1174 - } 3.1175 --#endif 3.1176 - 3.1177 - hstartcol = (numrows + 1 - parity) >> 1; 3.1178 - 3.1179 -@@ -907,12 +845,10 @@ 3.1180 - srcptr += numcols; 3.1181 - } 3.1182 - 3.1183 --#if !defined(HAVE_VLA) 3.1184 - /* If the join buffer was allocated on the heap, free this memory. */ 3.1185 - if (buf != joinbuf) { 3.1186 - jas_free(buf); 3.1187 - } 3.1188 --#endif 3.1189 - 3.1190 - } 3.1191 - 3.1192 ---- a/src/libjasper/jpc/jpc_t1enc.c 2007-01-19 22:43:07.000000000 +0100 3.1193 -+++ b/src/libjasper/jpc/jpc_t1enc.c 2015-01-28 17:57:34.128045603 +0100 3.1194 -@@ -219,7 +219,7 @@ 3.1195 - 3.1196 - cblk->numpasses = (cblk->numbps > 0) ? (3 * cblk->numbps - 2) : 0; 3.1197 - if (cblk->numpasses > 0) { 3.1198 -- cblk->passes = jas_malloc(cblk->numpasses * sizeof(jpc_enc_pass_t)); 3.1199 -+ cblk->passes = jas_alloc2(cblk->numpasses, sizeof(jpc_enc_pass_t)); 3.1200 - assert(cblk->passes); 3.1201 - } else { 3.1202 - cblk->passes = 0; 3.1203 ---- a/src/libjasper/jpc/jpc_t2cod.c 2007-01-19 22:43:07.000000000 +0100 3.1204 -+++ b/src/libjasper/jpc/jpc_t2cod.c 2015-01-28 17:57:34.128045603 +0100 3.1205 -@@ -573,7 +573,7 @@ 3.1206 - } 3.1207 - if (pchglist->numpchgs >= pchglist->maxpchgs) { 3.1208 - newmaxpchgs = pchglist->maxpchgs + 128; 3.1209 -- if (!(newpchgs = jas_realloc(pchglist->pchgs, newmaxpchgs * sizeof(jpc_pchg_t *)))) { 3.1210 -+ if (!(newpchgs = jas_realloc2(pchglist->pchgs, newmaxpchgs, sizeof(jpc_pchg_t *)))) { 3.1211 - return -1; 3.1212 - } 3.1213 - pchglist->maxpchgs = newmaxpchgs; 3.1214 ---- a/src/libjasper/jpc/jpc_t2dec.c 2007-01-19 22:43:07.000000000 +0100 3.1215 -+++ b/src/libjasper/jpc/jpc_t2dec.c 2015-01-28 17:57:34.129045620 +0100 3.1216 -@@ -478,7 +478,7 @@ 3.1217 - return 0; 3.1218 - } 3.1219 - pi->numcomps = dec->numcomps; 3.1220 -- if (!(pi->picomps = jas_malloc(pi->numcomps * sizeof(jpc_picomp_t)))) { 3.1221 -+ if (!(pi->picomps = jas_alloc2(pi->numcomps, sizeof(jpc_picomp_t)))) { 3.1222 - jpc_pi_destroy(pi); 3.1223 - return 0; 3.1224 - } 3.1225 -@@ -490,7 +490,7 @@ 3.1226 - for (compno = 0, tcomp = tile->tcomps, picomp = pi->picomps; 3.1227 - compno < pi->numcomps; ++compno, ++tcomp, ++picomp) { 3.1228 - picomp->numrlvls = tcomp->numrlvls; 3.1229 -- if (!(picomp->pirlvls = jas_malloc(picomp->numrlvls * 3.1230 -+ if (!(picomp->pirlvls = jas_alloc2(picomp->numrlvls, 3.1231 - sizeof(jpc_pirlvl_t)))) { 3.1232 - jpc_pi_destroy(pi); 3.1233 - return 0; 3.1234 -@@ -503,7 +503,7 @@ 3.1235 - rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl, ++rlvl) { 3.1236 - /* XXX sizeof(long) should be sizeof different type */ 3.1237 - pirlvl->numprcs = rlvl->numprcs; 3.1238 -- if (!(pirlvl->prclyrnos = jas_malloc(pirlvl->numprcs * 3.1239 -+ if (!(pirlvl->prclyrnos = jas_alloc2(pirlvl->numprcs, 3.1240 - sizeof(long)))) { 3.1241 - jpc_pi_destroy(pi); 3.1242 - return 0; 3.1243 ---- a/src/libjasper/jpc/jpc_t2enc.c 2007-01-19 22:43:07.000000000 +0100 3.1244 -+++ b/src/libjasper/jpc/jpc_t2enc.c 2015-01-28 17:57:34.129045620 +0100 3.1245 -@@ -565,7 +565,7 @@ 3.1246 - } 3.1247 - pi->pktno = -1; 3.1248 - pi->numcomps = cp->numcmpts; 3.1249 -- if (!(pi->picomps = jas_malloc(pi->numcomps * sizeof(jpc_picomp_t)))) { 3.1250 -+ if (!(pi->picomps = jas_alloc2(pi->numcomps, sizeof(jpc_picomp_t)))) { 3.1251 - jpc_pi_destroy(pi); 3.1252 - return 0; 3.1253 - } 3.1254 -@@ -577,7 +577,7 @@ 3.1255 - for (compno = 0, tcomp = tile->tcmpts, picomp = pi->picomps; 3.1256 - compno < pi->numcomps; ++compno, ++tcomp, ++picomp) { 3.1257 - picomp->numrlvls = tcomp->numrlvls; 3.1258 -- if (!(picomp->pirlvls = jas_malloc(picomp->numrlvls * 3.1259 -+ if (!(picomp->pirlvls = jas_alloc2(picomp->numrlvls, 3.1260 - sizeof(jpc_pirlvl_t)))) { 3.1261 - jpc_pi_destroy(pi); 3.1262 - return 0; 3.1263 -@@ -591,7 +591,7 @@ 3.1264 - /* XXX sizeof(long) should be sizeof different type */ 3.1265 - pirlvl->numprcs = rlvl->numprcs; 3.1266 - if (rlvl->numprcs) { 3.1267 -- if (!(pirlvl->prclyrnos = jas_malloc(pirlvl->numprcs * 3.1268 -+ if (!(pirlvl->prclyrnos = jas_alloc2(pirlvl->numprcs, 3.1269 - sizeof(long)))) { 3.1270 - jpc_pi_destroy(pi); 3.1271 - return 0; 3.1272 ---- a/src/libjasper/jpc/jpc_tagtree.c 2007-01-19 22:43:07.000000000 +0100 3.1273 -+++ b/src/libjasper/jpc/jpc_tagtree.c 2015-01-28 17:57:34.130045636 +0100 3.1274 -@@ -125,7 +125,7 @@ 3.1275 - ++numlvls; 3.1276 - } while (n > 1); 3.1277 - 3.1278 -- if (!(tree->nodes_ = jas_malloc(tree->numnodes_ * sizeof(jpc_tagtreenode_t)))) { 3.1279 -+ if (!(tree->nodes_ = jas_alloc2(tree->numnodes_, sizeof(jpc_tagtreenode_t)))) { 3.1280 - return 0; 3.1281 - } 3.1282 - 3.1283 ---- a/src/libjasper/jpc/jpc_util.c 2007-01-19 22:43:07.000000000 +0100 3.1284 -+++ b/src/libjasper/jpc/jpc_util.c 2015-01-28 17:57:34.130045636 +0100 3.1285 -@@ -109,7 +109,7 @@ 3.1286 - } 3.1287 - 3.1288 - if (n) { 3.1289 -- if (!(vs = jas_malloc(n * sizeof(double)))) { 3.1290 -+ if (!(vs = jas_alloc2(n, sizeof(double)))) { 3.1291 - return -1; 3.1292 - } 3.1293 - 3.1294 ---- a/src/libjasper/mif/mif_cod.c 2007-01-19 22:43:05.000000000 +0100 3.1295 -+++ b/src/libjasper/mif/mif_cod.c 2015-01-28 17:57:34.131045653 +0100 3.1296 -@@ -438,8 +438,7 @@ 3.1297 - int cmptno; 3.1298 - mif_cmpt_t **newcmpts; 3.1299 - assert(maxcmpts >= hdr->numcmpts); 3.1300 -- newcmpts = (!hdr->cmpts) ? jas_malloc(maxcmpts * sizeof(mif_cmpt_t *)) : 3.1301 -- jas_realloc(hdr->cmpts, maxcmpts * sizeof(mif_cmpt_t *)); 3.1302 -+ newcmpts = jas_realloc2(hdr->cmpts, maxcmpts, sizeof(mif_cmpt_t *)); 3.1303 - if (!newcmpts) { 3.1304 - return -1; 3.1305 - }
4.1 --- a/jasper/stuff/patches/series Thu Jun 08 19:49:38 2017 +0300 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,1 +0,0 @@ 4.4 -jasper-1.900.1-security_fixes-2.patch
5.1 --- a/jpeg-turbo/receipt Thu Jun 08 19:49:38 2017 +0300 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,19 +0,0 @@ 5.4 -# SliTaz package receipt. 5.5 - 5.6 -PACKAGE="jpeg-turbo" 5.7 -VERSION="1.5.0" 5.8 -CATEGORY="x-window" 5.9 -SHORT_DESC="JPEG image programs." 5.10 -MAINTAINER="pascal.bellard@slitaz.org" 5.11 -LICENSE="MIT" 5.12 -WEB_SITE="http://libjpeg-turbo.virtualgl.org/" 5.13 -TAGS="jpeg jpg" 5.14 - 5.15 -WANTED="libjpeg-turbo" 5.16 -DEPENDS="libjpeg-turbo" 5.17 - 5.18 -# Rules to gen a SliTaz package suitable for Tazpkg. 5.19 -genpkg_rules() 5.20 -{ 5.21 - cook_copy_folders bin 5.22 -}
6.1 --- a/lcms-apps/receipt Thu Jun 08 19:49:38 2017 +0300 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,20 +0,0 @@ 6.4 -# SliTaz package receipt. 6.5 - 6.6 -PACKAGE="lcms-apps" 6.7 -VERSION="1.19" 6.8 -CATEGORY="development" 6.9 -SHORT_DESC="Tiny appsa and tools from the LCMS project." 6.10 -MAINTAINER="pankso@slitaz.org" 6.11 -LICENSE="MIT" 6.12 -WANTED="lcms" 6.13 -WEB_SITE="http://www.littlecms.com/" 6.14 -HOST_ARCH="i486 arm" 6.15 - 6.16 -DEPENDS="lcms jpeg tiff zlib" 6.17 - 6.18 -# Rules to gen a SliTaz package suitable for Tazpkg. 6.19 -genpkg_rules() 6.20 -{ 6.21 - mkdir -p $fs/usr 6.22 - cp -a $install/usr/bin $fs/usr 6.23 -}
7.1 --- a/lcms-dev/receipt Thu Jun 08 19:49:38 2017 +0300 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,22 +0,0 @@ 7.4 -# SliTaz package receipt. 7.5 - 7.6 -PACKAGE="lcms-dev" 7.7 -VERSION="1.19" 7.8 -CATEGORY="development" 7.9 -SHORT_DESC="LCMS devel files." 7.10 -MAINTAINER="pankso@slitaz.org" 7.11 -LICENSE="MIT" 7.12 -WANTED="lcms" 7.13 -WEB_SITE="http://www.littlecms.com/" 7.14 -HOST_ARCH="i486 arm" 7.15 - 7.16 -DEPENDS="lcms pkg-config" 7.17 - 7.18 -# Rules to gen a SliTaz package suitable for Tazpkg. 7.19 -genpkg_rules() 7.20 -{ 7.21 - mkdir -p $fs/usr/lib 7.22 - cp -a $install/usr/include $fs/usr 7.23 - cp -a $install/usr/lib/*.*a $fs/usr/lib 7.24 - cp -a $install/usr/lib/pkgconfig $fs/usr/lib 7.25 -}
8.1 --- a/lcms/receipt Thu Jun 08 19:49:38 2017 +0300 8.2 +++ b/lcms/receipt Thu Jun 08 23:54:41 2017 +0300 8.3 @@ -1,18 +1,19 @@ 8.4 -# SliTaz package receipt. 8.5 +# SliTaz package receipt v2. 8.6 8.7 PACKAGE="lcms" 8.8 VERSION="1.19" 8.9 CATEGORY="graphics" 8.10 -SHORT_DESC="A free color management engine in 100K (library)." 8.11 +SHORT_DESC="A free color management engine in 100K" 8.12 MAINTAINER="pankso@slitaz.org" 8.13 LICENSE="MIT" 8.14 -TARBALL="$PACKAGE-${VERSION}.tar.gz" 8.15 WEB_SITE="http://www.littlecms.com/" 8.16 -WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" 8.17 HOST_ARCH="i486 arm" 8.18 8.19 -RELATED="lcms-dev lcms-apps" 8.20 -BUILD_DEPENDS="tiff-dev jpeg-dev zlib-dev gfortran liblzma-dev" #xz-dev? 8.21 +TARBALL="$PACKAGE-$VERSION.tar.gz" 8.22 +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" 8.23 + 8.24 +BUILD_DEPENDS="tiff-dev jpeg-dev zlib-dev gfortran xz-dev" 8.25 +SPLIT="lcms-dev lcms-apps" 8.26 8.27 # Rules to configure and make the package. 8.28 compile_rules() 8.29 @@ -25,7 +26,16 @@ 8.30 # Rules to gen a SliTaz package suitable for Tazpkg. 8.31 genpkg_rules() 8.32 { 8.33 - mkdir -p $fs/usr/lib 8.34 - cp -a $install/usr/lib/*.so* $fs/usr/lib 8.35 + case $PACKAGE in 8.36 + lcms) 8.37 + copy *.so 8.38 + ;; 8.39 + lcms-apps) 8.40 + copy bin/ 8.41 + CAT="development|applications" 8.42 + DEPENDS="lcms jpeg tiff zlib" 8.43 + ;; 8.44 + *-dev) copy @dev;; 8.45 + esac 8.46 } 8.47
9.1 --- a/lcms2-apps/receipt Thu Jun 08 19:49:38 2017 +0300 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,18 +0,0 @@ 9.4 -# SliTaz package receipt. 9.5 - 9.6 -PACKAGE="lcms2-apps" 9.7 -VERSION="2.8" 9.8 -CATEGORY="graphics" 9.9 -SHORT_DESC="Open source color management engine (applications)" 9.10 -MAINTAINER="al.bobylev@gmail.com" 9.11 -LICENSE="MIT" 9.12 -WEB_SITE="http://www.littlecms.com/" 9.13 - 9.14 -DEPENDS="lcms2 libjpeg-turbo tiff zlib" 9.15 -WANTED="lcms2" 9.16 - 9.17 -# Rules to gen a SliTaz package suitable for Tazpkg. 9.18 -genpkg_rules() 9.19 -{ 9.20 - cook_copy_folders bin 9.21 -}
10.1 --- a/lcms2-dev/receipt Thu Jun 08 19:49:38 2017 +0300 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,18 +0,0 @@ 10.4 -# SliTaz package receipt. 10.5 - 10.6 -PACKAGE="lcms2-dev" 10.7 -VERSION="2.8" 10.8 -CATEGORY="development" 10.9 -SHORT_DESC="Open source color management engine (development files)" 10.10 -MAINTAINER="al.bobylev@gmail.com" 10.11 -LICENSE="MIT" 10.12 -WEB_SITE="http://www.littlecms.com/" 10.13 - 10.14 -WANTED="lcms2" 10.15 -DEPENDS="lcms2 lcms2-apps" 10.16 - 10.17 -# Rules to gen a SliTaz package suitable for Tazpkg. 10.18 -genpkg_rules() 10.19 -{ 10.20 - cook_copy_files *.h *.la *.pc 10.21 -}
11.1 --- a/lcms2/receipt Thu Jun 08 19:49:38 2017 +0300 11.2 +++ b/lcms2/receipt Thu Jun 08 23:54:41 2017 +0300 11.3 @@ -1,9 +1,9 @@ 11.4 -# SliTaz package receipt. 11.5 +# SliTaz package receipt v2. 11.6 11.7 PACKAGE="lcms2" 11.8 VERSION="2.8" 11.9 CATEGORY="graphics" 11.10 -SHORT_DESC="Open source color management engine (library)" 11.11 +SHORT_DESC="Open source color management engine" 11.12 MAINTAINER="al.bobylev@gmail.com" 11.13 LICENSE="MIT" 11.14 WEB_SITE="http://www.littlecms.com/" 11.15 @@ -12,7 +12,7 @@ 11.16 WGET_URL="$SF_MIRROR/lcms/$TARBALL" 11.17 11.18 BUILD_DEPENDS="libjpeg-turbo-dev zlib-dev tiff-dev" 11.19 -SPLIT="lcms2-apps" 11.20 +SPLIT="lcms2-apps lcms2-dev" 11.21 11.22 # Rules to configure and make the package. 11.23 compile_rules() 11.24 @@ -26,5 +26,15 @@ 11.25 # Rules to gen a SliTaz package suitable for Tazpkg. 11.26 genpkg_rules() 11.27 { 11.28 - cook_copy_files *.so* 11.29 + case $PACKAGE in 11.30 + lcms2) 11.31 + copy *.so* 11.32 + ;; 11.33 + lcms2-apps) 11.34 + copy bin/ 11.35 + CAT="graphics|applications" 11.36 + DEPENDS="lcms2 libjpeg-turbo tiff zlib" 11.37 + ;; 11.38 + *-dev) copy @dev;; 11.39 + esac 11.40 }
12.1 --- a/libjpeg-turbo-dev/receipt Thu Jun 08 19:49:38 2017 +0300 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,19 +0,0 @@ 12.4 -# SliTaz package receipt. 12.5 - 12.6 -PACKAGE="libjpeg-turbo-dev" 12.7 -VERSION="1.5.0" 12.8 -CATEGORY="development" 12.9 -SHORT_DESC="JPEG image libs." 12.10 -MAINTAINER="pascal.bellard@slitaz.org" 12.11 -LICENSE="MIT" 12.12 -WEB_SITE="http://libjpeg-turbo.virtualgl.org/" 12.13 -TAGS="jpeg jpg" 12.14 - 12.15 -WANTED="libjpeg-turbo" 12.16 -DEPENDS="libjpeg-turbo" 12.17 - 12.18 -# Rules to gen a SliTaz package suitable for Tazpkg. 12.19 -genpkg_rules() 12.20 -{ 12.21 - cook_copy_files *.h *.la *.pc 12.22 -}
13.1 --- a/libjpeg-turbo/receipt Thu Jun 08 19:49:38 2017 +0300 13.2 +++ b/libjpeg-turbo/receipt Thu Jun 08 23:54:41 2017 +0300 13.3 @@ -1,20 +1,18 @@ 13.4 -# SliTaz package receipt. 13.5 +# SliTaz package receipt v2. 13.6 13.7 PACKAGE="libjpeg-turbo" 13.8 -VERSION="1.5.0" 13.9 +VERSION="1.5.1" 13.10 CATEGORY="libs" 13.11 -SHORT_DESC="JPEG image libs." 13.12 +SHORT_DESC="Accelerated JPEG image codec" 13.13 MAINTAINER="pascal.bellard@slitaz.org" 13.14 LICENSE="MIT" 13.15 WEB_SITE="http://libjpeg-turbo.virtualgl.org/" 13.16 -TAGS="jpeg jpg" 13.17 -PROVIDE="libjpeg" 13.18 13.19 TARBALL="$PACKAGE-$VERSION.tar.gz" 13.20 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" 13.21 13.22 BUILD_DEPENDS="nasm" 13.23 -SPLIT="jpeg-turbo" 13.24 +SPLIT="jpeg-turbo libjpeg-turbo-dev" 13.25 13.26 # Rules to configure and make the package. 13.27 compile_rules() 13.28 @@ -30,5 +28,17 @@ 13.29 # Rules to gen a SliTaz package suitable for Tazpkg. 13.30 genpkg_rules() 13.31 { 13.32 - cook_copy_files *.so* 13.33 + case $PACKAGE in 13.34 + libjpeg-turbo) 13.35 + copy *.so* 13.36 + TAGS="jpeg jpg" 13.37 + PROVIDE="libjpeg" 13.38 + ;; 13.39 + jpeg-turbo) 13.40 + copy bin/ 13.41 + CAT="x-window|programs" 13.42 + TAGS="jpeg jpg" 13.43 + ;; 13.44 + *-dev) copy @dev;; 13.45 + esac 13.46 }
14.1 --- a/liblinebreak-dev/receipt Thu Jun 08 19:49:38 2017 +0300 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,19 +0,0 @@ 14.4 -# SliTaz package receipt. 14.5 - 14.6 -PACKAGE="liblinebreak-dev" 14.7 -VERSION="2.0" 14.8 -CATEGORY="development" 14.9 -SHORT_DESC="Line breaking library" 14.10 -MAINTAINER="devl547@gmail.com" 14.11 -LICENSE="zlib/libpng" 14.12 -WEB_SITE="http://vimgadgets.sourceforge.net/liblinebreak/" 14.13 -WANTED="liblinebreak" 14.14 - 14.15 -# Rules to gen a SliTaz package suitable for Tazpkg. 14.16 -genpkg_rules() 14.17 -{ 14.18 - mkdir -p $fs/usr/lib 14.19 - cp -a $install/usr/lib/*a $fs/usr/lib 14.20 - cp -a $install/usr/include $fs/usr 14.21 -} 14.22 -
15.1 --- a/liblinebreak/receipt Thu Jun 08 19:49:38 2017 +0300 15.2 +++ b/liblinebreak/receipt Thu Jun 08 23:54:41 2017 +0300 15.3 @@ -1,28 +1,30 @@ 15.4 -# SliTaz package receipt. 15.5 +# SliTaz package receipt v2. 15.6 15.7 PACKAGE="liblinebreak" 15.8 -VERSION="2.0" 15.9 -CATEGORY="development" 15.10 +VERSION="2.1" 15.11 +CATEGORY="libdevel" 15.12 SHORT_DESC="Line breaking library" 15.13 MAINTAINER="devl547@gmail.com" 15.14 LICENSE="zlib/libpng" 15.15 +WEB_SITE="http://vimgadgets.sourceforge.net/liblinebreak/" 15.16 + 15.17 TARBALL="$PACKAGE-$VERSION.tar.gz" 15.18 -WEB_SITE="http://vimgadgets.sourceforge.net/liblinebreak/" 15.19 -WGET_URL="http://downloads.sourceforge.net/project/vimgadgets/$PACKAGE/$VERSION/$TARBALL" 15.20 +WGET_URL="$SF_MIRROR/vimgadgets/$PACKAGE/$TARBALL" 15.21 + 15.22 +BUILD_DEPENDS="gfortran" 15.23 +SPLIT="liblinebreak-dev" 15.24 15.25 # Rules to configure and make the package. 15.26 compile_rules() 15.27 { 15.28 - cd $src 15.29 - ./configure --prefix=/usr $CONFIGURE_ARGS && 15.30 - make && 15.31 - make DESTDIR=$DESTDIR install 15.32 + ./configure $CONFIGURE_ARGS && make && make DESTDIR=$DESTDIR install 15.33 } 15.34 15.35 # Rules to gen a SliTaz package suitable for Tazpkg. 15.36 genpkg_rules() 15.37 { 15.38 - mkdir -p $fs/usr/lib 15.39 - cp -a $install/usr/lib/*.so* $fs/usr/lib 15.40 + case $PACKAGE in 15.41 + liblinebreak) copy @std;; 15.42 + *-dev) copy @dev;; 15.43 + esac 15.44 } 15.45 -
16.1 --- a/net-snmp/receipt Thu Jun 08 19:49:38 2017 +0300 16.2 +++ b/net-snmp/receipt Thu Jun 08 23:54:41 2017 +0300 16.3 @@ -12,7 +12,7 @@ 16.4 TARBALL="$PACKAGE-$VERSION.tar.gz" 16.5 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" 16.6 16.7 -BUILD_DEPENDS="perl openssl-dev file" 16.8 +BUILD_DEPENDS="perl-dev openssl-dev file" 16.9 SPLIT="net-snmp-dev" 16.10 16.11 # Rules to configure and make the package.