lol

jasper: CVE-2014-8157, CVE-2014-8158, fixes #6114

+346 -2
+5 -2
pkgs/development/libraries/jasper/default.nix
··· 1 - {stdenv, fetchurl, unzip, xlibs, libjpeg}: 1 + { stdenv, fetchurl, unzip, xlibs, libjpeg }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 name = "jasper-1.900.1"; ··· 9 9 }; 10 10 11 11 patches = [ 12 - ./jasper-CVE-2014-8137-variant2.diff ./jasper-CVE-2014-8137-noabort.diff 12 + ./jasper-CVE-2014-8137-variant2.diff 13 + ./jasper-CVE-2014-8137-noabort.diff 13 14 ./jasper-CVE-2014-8138.diff 15 + ./jasper-CVE-2014-8157.diff 16 + ./jasper-CVE-2014-8158.diff 14 17 ./jasper-CVE-2014-9029.diff 15 18 ]; 16 19
+12
pkgs/development/libraries/jasper/jasper-CVE-2014-8157.diff
··· 1 + diff -up jasper-1.900.1/src/libjasper/jpc/jpc_dec.c.CVE-2014-8157 jasper-1.900.1/src/libjasper/jpc/jpc_dec.c 2 + --- jasper-1.900.1/src/libjasper/jpc/jpc_dec.c.CVE-2014-8157 2015-01-19 16:59:36.000000000 +0100 3 + +++ jasper-1.900.1/src/libjasper/jpc/jpc_dec.c 2015-01-19 17:07:41.609863268 +0100 4 + @@ -489,7 +489,7 @@ static int jpc_dec_process_sot(jpc_dec_t 5 + dec->curtileendoff = 0; 6 + } 7 + 8 + - if (JAS_CAST(int, sot->tileno) > dec->numtiles) { 9 + + if (JAS_CAST(int, sot->tileno) >= dec->numtiles) { 10 + jas_eprintf("invalid tile number in SOT marker segment\n"); 11 + return -1; 12 + }
+329
pkgs/development/libraries/jasper/jasper-CVE-2014-8158.diff
··· 1 + diff -up jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c.CVE-2014-8158 jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c 2 + --- jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c.CVE-2014-8158 2015-01-19 17:25:28.730195502 +0100 3 + +++ jasper-1.900.1/src/libjasper/jpc/jpc_qmfb.c 2015-01-19 17:27:20.214663127 +0100 4 + @@ -306,11 +306,7 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in 5 + { 6 + 7 + int bufsize = JPC_CEILDIVPOW2(numcols, 1); 8 + -#if !defined(HAVE_VLA) 9 + jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; 10 + -#else 11 + - jpc_fix_t splitbuf[bufsize]; 12 + -#endif 13 + jpc_fix_t *buf = splitbuf; 14 + register jpc_fix_t *srcptr; 15 + register jpc_fix_t *dstptr; 16 + @@ -318,7 +314,6 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in 17 + register int m; 18 + int hstartcol; 19 + 20 + -#if !defined(HAVE_VLA) 21 + /* Get a buffer. */ 22 + if (bufsize > QMFB_SPLITBUFSIZE) { 23 + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 24 + @@ -326,7 +321,6 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in 25 + abort(); 26 + } 27 + } 28 + -#endif 29 + 30 + if (numcols >= 2) { 31 + hstartcol = (numcols + 1 - parity) >> 1; 32 + @@ -360,12 +354,10 @@ void jpc_qmfb_split_row(jpc_fix_t *a, in 33 + } 34 + } 35 + 36 + -#if !defined(HAVE_VLA) 37 + /* If the split buffer was allocated on the heap, free this memory. */ 38 + if (buf != splitbuf) { 39 + jas_free(buf); 40 + } 41 + -#endif 42 + 43 + } 44 + 45 + @@ -374,11 +366,7 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in 46 + { 47 + 48 + int bufsize = JPC_CEILDIVPOW2(numrows, 1); 49 + -#if !defined(HAVE_VLA) 50 + jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; 51 + -#else 52 + - jpc_fix_t splitbuf[bufsize]; 53 + -#endif 54 + jpc_fix_t *buf = splitbuf; 55 + register jpc_fix_t *srcptr; 56 + register jpc_fix_t *dstptr; 57 + @@ -386,7 +374,6 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in 58 + register int m; 59 + int hstartcol; 60 + 61 + -#if !defined(HAVE_VLA) 62 + /* Get a buffer. */ 63 + if (bufsize > QMFB_SPLITBUFSIZE) { 64 + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 65 + @@ -394,7 +381,6 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in 66 + abort(); 67 + } 68 + } 69 + -#endif 70 + 71 + if (numrows >= 2) { 72 + hstartcol = (numrows + 1 - parity) >> 1; 73 + @@ -428,12 +414,10 @@ void jpc_qmfb_split_col(jpc_fix_t *a, in 74 + } 75 + } 76 + 77 + -#if !defined(HAVE_VLA) 78 + /* If the split buffer was allocated on the heap, free this memory. */ 79 + if (buf != splitbuf) { 80 + jas_free(buf); 81 + } 82 + -#endif 83 + 84 + } 85 + 86 + @@ -442,11 +426,7 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a, 87 + { 88 + 89 + int bufsize = JPC_CEILDIVPOW2(numrows, 1); 90 + -#if !defined(HAVE_VLA) 91 + jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE]; 92 + -#else 93 + - jpc_fix_t splitbuf[bufsize * JPC_QMFB_COLGRPSIZE]; 94 + -#endif 95 + jpc_fix_t *buf = splitbuf; 96 + jpc_fix_t *srcptr; 97 + jpc_fix_t *dstptr; 98 + @@ -457,7 +437,6 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a, 99 + int m; 100 + int hstartcol; 101 + 102 + -#if !defined(HAVE_VLA) 103 + /* Get a buffer. */ 104 + if (bufsize > QMFB_SPLITBUFSIZE) { 105 + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 106 + @@ -465,7 +444,6 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a, 107 + abort(); 108 + } 109 + } 110 + -#endif 111 + 112 + if (numrows >= 2) { 113 + hstartcol = (numrows + 1 - parity) >> 1; 114 + @@ -517,12 +495,10 @@ void jpc_qmfb_split_colgrp(jpc_fix_t *a, 115 + } 116 + } 117 + 118 + -#if !defined(HAVE_VLA) 119 + /* If the split buffer was allocated on the heap, free this memory. */ 120 + if (buf != splitbuf) { 121 + jas_free(buf); 122 + } 123 + -#endif 124 + 125 + } 126 + 127 + @@ -531,11 +507,7 @@ void jpc_qmfb_split_colres(jpc_fix_t *a, 128 + { 129 + 130 + int bufsize = JPC_CEILDIVPOW2(numrows, 1); 131 + -#if !defined(HAVE_VLA) 132 + jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE]; 133 + -#else 134 + - jpc_fix_t splitbuf[bufsize * numcols]; 135 + -#endif 136 + jpc_fix_t *buf = splitbuf; 137 + jpc_fix_t *srcptr; 138 + jpc_fix_t *dstptr; 139 + @@ -546,7 +518,6 @@ void jpc_qmfb_split_colres(jpc_fix_t *a, 140 + int m; 141 + int hstartcol; 142 + 143 + -#if !defined(HAVE_VLA) 144 + /* Get a buffer. */ 145 + if (bufsize > QMFB_SPLITBUFSIZE) { 146 + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 147 + @@ -554,7 +525,6 @@ void jpc_qmfb_split_colres(jpc_fix_t *a, 148 + abort(); 149 + } 150 + } 151 + -#endif 152 + 153 + if (numrows >= 2) { 154 + hstartcol = (numrows + 1 - parity) >> 1; 155 + @@ -606,12 +576,10 @@ void jpc_qmfb_split_colres(jpc_fix_t *a, 156 + } 157 + } 158 + 159 + -#if !defined(HAVE_VLA) 160 + /* If the split buffer was allocated on the heap, free this memory. */ 161 + if (buf != splitbuf) { 162 + jas_free(buf); 163 + } 164 + -#endif 165 + 166 + } 167 + 168 + @@ -619,18 +587,13 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int 169 + { 170 + 171 + int bufsize = JPC_CEILDIVPOW2(numcols, 1); 172 + -#if !defined(HAVE_VLA) 173 + jpc_fix_t joinbuf[QMFB_JOINBUFSIZE]; 174 + -#else 175 + - jpc_fix_t joinbuf[bufsize]; 176 + -#endif 177 + jpc_fix_t *buf = joinbuf; 178 + register jpc_fix_t *srcptr; 179 + register jpc_fix_t *dstptr; 180 + register int n; 181 + int hstartcol; 182 + 183 + -#if !defined(HAVE_VLA) 184 + /* Allocate memory for the join buffer from the heap. */ 185 + if (bufsize > QMFB_JOINBUFSIZE) { 186 + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 187 + @@ -638,7 +601,6 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int 188 + abort(); 189 + } 190 + } 191 + -#endif 192 + 193 + hstartcol = (numcols + 1 - parity) >> 1; 194 + 195 + @@ -670,12 +632,10 @@ void jpc_qmfb_join_row(jpc_fix_t *a, int 196 + ++srcptr; 197 + } 198 + 199 + -#if !defined(HAVE_VLA) 200 + /* If the join buffer was allocated on the heap, free this memory. */ 201 + if (buf != joinbuf) { 202 + jas_free(buf); 203 + } 204 + -#endif 205 + 206 + } 207 + 208 + @@ -684,18 +644,13 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int 209 + { 210 + 211 + int bufsize = JPC_CEILDIVPOW2(numrows, 1); 212 + -#if !defined(HAVE_VLA) 213 + jpc_fix_t joinbuf[QMFB_JOINBUFSIZE]; 214 + -#else 215 + - jpc_fix_t joinbuf[bufsize]; 216 + -#endif 217 + jpc_fix_t *buf = joinbuf; 218 + register jpc_fix_t *srcptr; 219 + register jpc_fix_t *dstptr; 220 + register int n; 221 + int hstartcol; 222 + 223 + -#if !defined(HAVE_VLA) 224 + /* Allocate memory for the join buffer from the heap. */ 225 + if (bufsize > QMFB_JOINBUFSIZE) { 226 + if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { 227 + @@ -703,7 +658,6 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int 228 + abort(); 229 + } 230 + } 231 + -#endif 232 + 233 + hstartcol = (numrows + 1 - parity) >> 1; 234 + 235 + @@ -735,12 +689,10 @@ void jpc_qmfb_join_col(jpc_fix_t *a, int 236 + ++srcptr; 237 + } 238 + 239 + -#if !defined(HAVE_VLA) 240 + /* If the join buffer was allocated on the heap, free this memory. */ 241 + if (buf != joinbuf) { 242 + jas_free(buf); 243 + } 244 + -#endif 245 + 246 + } 247 + 248 + @@ -749,11 +701,7 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a, 249 + { 250 + 251 + int bufsize = JPC_CEILDIVPOW2(numrows, 1); 252 + -#if !defined(HAVE_VLA) 253 + jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE]; 254 + -#else 255 + - jpc_fix_t joinbuf[bufsize * JPC_QMFB_COLGRPSIZE]; 256 + -#endif 257 + jpc_fix_t *buf = joinbuf; 258 + jpc_fix_t *srcptr; 259 + jpc_fix_t *dstptr; 260 + @@ -763,7 +711,6 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a, 261 + register int i; 262 + int hstartcol; 263 + 264 + -#if !defined(HAVE_VLA) 265 + /* Allocate memory for the join buffer from the heap. */ 266 + if (bufsize > QMFB_JOINBUFSIZE) { 267 + if (!(buf = jas_alloc2(bufsize, JPC_QMFB_COLGRPSIZE * sizeof(jpc_fix_t)))) { 268 + @@ -771,7 +718,6 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a, 269 + abort(); 270 + } 271 + } 272 + -#endif 273 + 274 + hstartcol = (numrows + 1 - parity) >> 1; 275 + 276 + @@ -821,12 +767,10 @@ void jpc_qmfb_join_colgrp(jpc_fix_t *a, 277 + srcptr += JPC_QMFB_COLGRPSIZE; 278 + } 279 + 280 + -#if !defined(HAVE_VLA) 281 + /* If the join buffer was allocated on the heap, free this memory. */ 282 + if (buf != joinbuf) { 283 + jas_free(buf); 284 + } 285 + -#endif 286 + 287 + } 288 + 289 + @@ -835,11 +779,7 @@ void jpc_qmfb_join_colres(jpc_fix_t *a, 290 + { 291 + 292 + int bufsize = JPC_CEILDIVPOW2(numrows, 1); 293 + -#if !defined(HAVE_VLA) 294 + jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE]; 295 + -#else 296 + - jpc_fix_t joinbuf[bufsize * numcols]; 297 + -#endif 298 + jpc_fix_t *buf = joinbuf; 299 + jpc_fix_t *srcptr; 300 + jpc_fix_t *dstptr; 301 + @@ -849,7 +789,6 @@ void jpc_qmfb_join_colres(jpc_fix_t *a, 302 + register int i; 303 + int hstartcol; 304 + 305 + -#if !defined(HAVE_VLA) 306 + /* Allocate memory for the join buffer from the heap. */ 307 + if (bufsize > QMFB_JOINBUFSIZE) { 308 + if (!(buf = jas_alloc3(bufsize, numcols, sizeof(jpc_fix_t)))) { 309 + @@ -857,7 +796,6 @@ void jpc_qmfb_join_colres(jpc_fix_t *a, 310 + abort(); 311 + } 312 + } 313 + -#endif 314 + 315 + hstartcol = (numrows + 1 - parity) >> 1; 316 + 317 + @@ -907,12 +845,10 @@ void jpc_qmfb_join_colres(jpc_fix_t *a, 318 + srcptr += numcols; 319 + } 320 + 321 + -#if !defined(HAVE_VLA) 322 + /* If the join buffer was allocated on the heap, free this memory. */ 323 + if (buf != joinbuf) { 324 + jas_free(buf); 325 + } 326 + -#endif 327 + 328 + } 329 +