Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/pi.c

Issue 1245853002: Merge to M44: Fix an integer overflow issue in openJpeg (Closed) Base URL: https://pdfium.googlesource.com/pdfium@2403
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * The copyright in this software is being made available under the 2-clauses 2 * The copyright in this software is being made available under the 2-clauses
3 * BSD License, included below. This software may be subject to other third 3 * BSD License, included below. This software may be subject to other third
4 * party and contributor rights, including patent rights, and no such rights 4 * party and contributor rights, including patent rights, and no such rights
5 * are granted under this license. 5 * are granted under this license.
6 * 6 *
7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
8 * Copyright (c) 2002-2014, Professor Benoit Macq 8 * Copyright (c) 2002-2014, Professor Benoit Macq
9 * Copyright (c) 2001-2003, David Janssens 9 * Copyright (c) 2001-2003, David Janssens
10 * Copyright (c) 2002-2003, Yannick Verschueren 10 * Copyright (c) 2002-2003, Yannick Verschueren
(...skipping 18 matching lines...) Expand all
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38 38
39 #include <limits.h>
39 #include "opj_includes.h" 40 #include "opj_includes.h"
40 41
41 /** @defgroup PI PI - Implementation of a packet iterator */ 42 /** @defgroup PI PI - Implementation of a packet iterator */
42 /*@{*/ 43 /*@{*/
43 44
44 /** @name Local static functions */ 45 /** @name Local static functions */
45 /*@{*/ 46 /*@{*/
46 47
47 /** 48 /**
48 Get next packet in layer-resolution-component-precinct order. 49 Get next packet in layer-resolution-component-precinct order.
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 /* step calculations */ 1230 /* step calculations */
1230 l_step_p = 1; 1231 l_step_p = 1;
1231 l_step_c = l_max_prec * l_step_p; 1232 l_step_c = l_max_prec * l_step_p;
1232 l_step_r = p_image->numcomps * l_step_c; 1233 l_step_r = p_image->numcomps * l_step_c;
1233 l_step_l = l_max_res * l_step_r; 1234 l_step_l = l_max_res * l_step_r;
1234 1235
1235 /* set values for first packet iterator */ 1236 /* set values for first packet iterator */
1236 l_current_pi = l_pi; 1237 l_current_pi = l_pi;
1237 1238
1238 /* memory allocation for include */ 1239 /* memory allocation for include */
1239 » l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16)); 1240 » l_current_pi->include = 00;
1241 » if
1242 » » (l_step_l && l_tcp->numlayers < UINT_MAX / l_step_l - 1)
1243 » {
1244 » » l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayer s + 1) * l_step_l, sizeof(OPJ_INT16));
1245 » }
1246
1240 if 1247 if
1241 (!l_current_pi->include) 1248 (!l_current_pi->include)
1242 { 1249 {
1243 opj_free(l_tmp_data); 1250 opj_free(l_tmp_data);
1244 opj_free(l_tmp_ptr); 1251 opj_free(l_tmp_ptr);
1245 opj_pi_destroy(l_pi, l_bound); 1252 opj_pi_destroy(l_pi, l_bound);
1246 return 00; 1253 return 00;
1247 } 1254 }
1248 1255
1249 /* special treatment for the first packet iterator */ 1256 /* special treatment for the first packet iterator */
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 case OPJ_PCRL: 1875 case OPJ_PCRL:
1869 return opj_pi_next_pcrl(pi); 1876 return opj_pi_next_pcrl(pi);
1870 case OPJ_CPRL: 1877 case OPJ_CPRL:
1871 return opj_pi_next_cprl(pi); 1878 return opj_pi_next_cprl(pi);
1872 case OPJ_PROG_UNKNOWN: 1879 case OPJ_PROG_UNKNOWN:
1873 return OPJ_FALSE; 1880 return OPJ_FALSE;
1874 } 1881 }
1875 1882
1876 return OPJ_FALSE; 1883 return OPJ_FALSE;
1877 } 1884 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698