~ubuntu-branches/ubuntu/trusty/libjpeg-turbo/trusty-proposed

« back to all changes in this revision

Viewing changes to jdmrgext.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose, Tom Gall, Matthias Klose
  • Date: 2012-09-20 00:18:15 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120920001815-eijk7v63d1nv0vbo
Tags: 1.2.1-0ubuntu1
[ Tom Gall ]
* Update to stable 1.2.1. LP: #1012861.
  * Addresses CVE-2012-2806. LP: #1025537.
    A Heap-based buffer overflow was found in the way libjpeg-turbo
    decompressed certain corrupt JPEG images in which the component count
    was erroneously set to a large value. An attacker could create a
    specially-crafted JPEG image that, when opened, could cause an
    application using libpng to crash or, possibly, execute arbitrary code
    with the privileges of the user running the application.
  * Cosmetic fixes to argument lists
  * Added flags to the TurboJPEG API that allow the caller to force
    the use of either the fast or the accurate DCT/IDCT algorithms
    in the underlying codec.
  * More recent versions of autoconf add -traditional-cpp to the CPP
    flags, which causes jsimdcfg.inc.h to not preprocess correctly
    unless we expand all of the instances of the #definev macro.
  * Fixed regression caused by a bug in the 32-bit strict memory access
    code in jdmrgss2.asm (contributed by Chromium to stop valgrind from
    whining whenever the output buffer size was not evenly divisible by
    16 bytes.)  On Linux/x86, this regression generated incorrect
    pixels on the right-hand side of images whose rows were not 16-byte
    aligned, whenever fancy upsampling was used.  This patch also
    enables the strict memory access code on all platforms, not just
    Linux (it does no harm on other platforms) and removes a couple of
    pcmpeqb instructions that were rendered unnecessary by r835.
  * Accelerated 4:2:2 upsampling routine for ARM (improves
    performance ~20-30% when decompressing 4:2:2 JPEGs using
    fancy upsampling)
  * Eliminate the use of the MASKMOVDQU instruction, to speed
    up decompression performance by 10x on AMD Bobcat embedded
    processors (and ~5% on AMD desktop processors.)
  * add tjbench to libjpeg-turbo-test packages
  * Guard against num_components being a ridiculous
    value due to a corrupt header
  * Preserve all 128 bits of xmm6 and xmm7

[ Matthias Klose ]
* Prepare the package for quantal, basing on the 1.2.1 release tarball.
* d/patches/branch-updates.diff: Update to 20120919 of the 1.2.x branch,
  but don't bump the version to 1.2.2.
* d/patches/guard-inline-define: Remove, integrated upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * jdmrgext.c
3
3
 *
4
4
 * Copyright (C) 1994-1996, Thomas G. Lane.
 
5
 * Copyright (C) 2011, D. R. Commander.
5
6
 * This file is part of the Independent JPEG Group's software.
6
7
 * For conditions of distribution and use, see the accompanying README file.
7
8
 *
54
55
    outptr[RGB_RED] =   range_limit[y + cred];
55
56
    outptr[RGB_GREEN] = range_limit[y + cgreen];
56
57
    outptr[RGB_BLUE] =  range_limit[y + cblue];
 
58
#ifdef RGB_ALPHA
 
59
    outptr[RGB_ALPHA] = 0xFF;
 
60
#endif
57
61
    outptr += RGB_PIXELSIZE;
58
62
    y  = GETJSAMPLE(*inptr0++);
59
63
    outptr[RGB_RED] =   range_limit[y + cred];
60
64
    outptr[RGB_GREEN] = range_limit[y + cgreen];
61
65
    outptr[RGB_BLUE] =  range_limit[y + cblue];
 
66
#ifdef RGB_ALPHA
 
67
    outptr[RGB_ALPHA] = 0xFF;
 
68
#endif
62
69
    outptr += RGB_PIXELSIZE;
63
70
  }
64
71
  /* If image width is odd, do the last output column separately */
72
79
    outptr[RGB_RED] =   range_limit[y + cred];
73
80
    outptr[RGB_GREEN] = range_limit[y + cgreen];
74
81
    outptr[RGB_BLUE] =  range_limit[y + cblue];
 
82
#ifdef RGB_ALPHA
 
83
    outptr[RGB_ALPHA] = 0xFF;
 
84
#endif
75
85
  }
76
86
}
77
87
 
120
130
    outptr0[RGB_RED] =   range_limit[y + cred];
121
131
    outptr0[RGB_GREEN] = range_limit[y + cgreen];
122
132
    outptr0[RGB_BLUE] =  range_limit[y + cblue];
 
133
#ifdef RGB_ALPHA
 
134
    outptr0[RGB_ALPHA] = 0xFF;
 
135
#endif
123
136
    outptr0 += RGB_PIXELSIZE;
124
137
    y  = GETJSAMPLE(*inptr00++);
125
138
    outptr0[RGB_RED] =   range_limit[y + cred];
126
139
    outptr0[RGB_GREEN] = range_limit[y + cgreen];
127
140
    outptr0[RGB_BLUE] =  range_limit[y + cblue];
 
141
#ifdef RGB_ALPHA
 
142
    outptr0[RGB_ALPHA] = 0xFF;
 
143
#endif
128
144
    outptr0 += RGB_PIXELSIZE;
129
145
    y  = GETJSAMPLE(*inptr01++);
130
146
    outptr1[RGB_RED] =   range_limit[y + cred];
131
147
    outptr1[RGB_GREEN] = range_limit[y + cgreen];
132
148
    outptr1[RGB_BLUE] =  range_limit[y + cblue];
 
149
#ifdef RGB_ALPHA
 
150
    outptr1[RGB_ALPHA] = 0xFF;
 
151
#endif
133
152
    outptr1 += RGB_PIXELSIZE;
134
153
    y  = GETJSAMPLE(*inptr01++);
135
154
    outptr1[RGB_RED] =   range_limit[y + cred];
136
155
    outptr1[RGB_GREEN] = range_limit[y + cgreen];
137
156
    outptr1[RGB_BLUE] =  range_limit[y + cblue];
 
157
#ifdef RGB_ALPHA
 
158
    outptr1[RGB_ALPHA] = 0xFF;
 
159
#endif
138
160
    outptr1 += RGB_PIXELSIZE;
139
161
  }
140
162
  /* If image width is odd, do the last output column separately */
148
170
    outptr0[RGB_RED] =   range_limit[y + cred];
149
171
    outptr0[RGB_GREEN] = range_limit[y + cgreen];
150
172
    outptr0[RGB_BLUE] =  range_limit[y + cblue];
 
173
#ifdef RGB_ALPHA
 
174
    outptr0[RGB_ALPHA] = 0xFF;
 
175
#endif
151
176
    y  = GETJSAMPLE(*inptr01);
152
177
    outptr1[RGB_RED] =   range_limit[y + cred];
153
178
    outptr1[RGB_GREEN] = range_limit[y + cgreen];
154
179
    outptr1[RGB_BLUE] =  range_limit[y + cblue];
 
180
#ifdef RGB_ALPHA
 
181
    outptr1[RGB_ALPHA] = 0xFF;
 
182
#endif
155
183
  }
156
184
}