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

Side by Side Diff: third_party/libopenjpeg20/tcd.c

Issue 1520323004: Merge to XFA: Fix a dividing zero bug in opj_tcd_init_tile() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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 | « third_party/libopenjpeg20/README.pdfium ('k') | 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 /*tile->numcomps = image->numcomps; */ 720 /*tile->numcomps = image->numcomps; */
721 for (compno = 0; compno < l_tile->numcomps; ++compno) { 721 for (compno = 0; compno < l_tile->numcomps; ++compno) {
722 /*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps); */ 722 /*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps); */
723 l_image_comp->resno_decoded = 0; 723 l_image_comp->resno_decoded = 0;
724 /* border of each l_tile component (global) */ 724 /* border of each l_tile component (global) */
725 l_tilec->x0 = opj_int_ceildiv(l_tile->x0, (OPJ_INT32)l_image_com p->dx); 725 l_tilec->x0 = opj_int_ceildiv(l_tile->x0, (OPJ_INT32)l_image_com p->dx);
726 l_tilec->y0 = opj_int_ceildiv(l_tile->y0, (OPJ_INT32)l_image_com p->dy); 726 l_tilec->y0 = opj_int_ceildiv(l_tile->y0, (OPJ_INT32)l_image_com p->dy);
727 l_tilec->x1 = opj_int_ceildiv(l_tile->x1, (OPJ_INT32)l_image_com p->dx); 727 l_tilec->x1 = opj_int_ceildiv(l_tile->x1, (OPJ_INT32)l_image_com p->dx);
728 l_tilec->y1 = opj_int_ceildiv(l_tile->y1, (OPJ_INT32)l_image_com p->dy); 728 l_tilec->y1 = opj_int_ceildiv(l_tile->y1, (OPJ_INT32)l_image_com p->dy);
729 /*fprintf(stderr, "\tTile compo border = %d,%d,%d,%d\n", l_tilec ->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/ 729 /*fprintf(stderr, "\tTile compo border = %d,%d,%d,%d\n", l_tilec ->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/
730 » » 730 » » if (l_tilec->x0 >= l_tilec->x1 || l_tilec->y0 >= l_tilec->y1) {
731 » » » opj_event_msg(manager, EVT_ERROR, "Invalid tile data\n") ;
732 » » » return OPJ_FALSE;
733 » » }
731 /* compute l_data_size with overflow check */ 734 /* compute l_data_size with overflow check */
732 l_data_size = (OPJ_UINT32)(l_tilec->x1 - l_tilec->x0); 735 l_data_size = (OPJ_UINT32)(l_tilec->x1 - l_tilec->x0);
733 if ((((OPJ_UINT32)-1) / l_data_size) < (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0)) { 736 if ((((OPJ_UINT32)-1) / l_data_size) < (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0)) {
734 opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile data\n"); 737 opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile data\n");
735 return OPJ_FALSE; 738 return OPJ_FALSE;
736 } 739 }
737 l_data_size = l_data_size * (OPJ_UINT32)(l_tilec->y1 - l_tilec-> y0); 740 l_data_size = l_data_size * (OPJ_UINT32)(l_tilec->y1 - l_tilec-> y0);
738 741
739 if ((((OPJ_UINT32)-1) / (OPJ_UINT32)sizeof(OPJ_UINT32)) < l_data _size) { 742 if ((((OPJ_UINT32)-1) / (OPJ_UINT32)sizeof(OPJ_UINT32)) < l_data _size) {
740 opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile data\n"); 743 opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile data\n");
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 } 2196 }
2194 break; 2197 break;
2195 } 2198 }
2196 2199
2197 ++l_img_comp; 2200 ++l_img_comp;
2198 ++l_tilec; 2201 ++l_tilec;
2199 } 2202 }
2200 2203
2201 return OPJ_TRUE; 2204 return OPJ_TRUE;
2202 } 2205 }
OLDNEW
« no previous file with comments | « third_party/libopenjpeg20/README.pdfium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698