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

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

Issue 1590593002: Merge to XFA: openjpeg: Fix potential bad precno value in opj_pi_next* functions. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 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 | « 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 if ((res->pw==0)||(res->ph==0)) continue ; 371 if ((res->pw==0)||(res->ph==0)) continue ;
372 372
373 if ((trx0==trx1)||(try0==try1)) continue ; 373 if ((trx0==trx1)||(try0==try1)) continue ;
374 374
375 prci = opj_int_floordivpow2(opj_int_ceil div(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx) 375 prci = opj_int_floordivpow2(opj_int_ceil div(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
376 - opj_int_floordivpow2(trx0, (O PJ_INT32)res->pdx); 376 - opj_int_floordivpow2(trx0, (O PJ_INT32)res->pdx);
377 prcj = opj_int_floordivpow2(opj_int_ceil div(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy) 377 prcj = opj_int_floordivpow2(opj_int_ceil div(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
378 - opj_int_floordivpow2(try0, (O PJ_INT32)res->pdy); 378 - opj_int_floordivpow2(try0, (O PJ_INT32)res->pdy);
379 pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw); 379 pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
380 if (pi->precno >= res->pw * res->ph) {
381 return OPJ_FALSE;
382 }
380 for (pi->layno = pi->poc.layno0; pi->lay no < pi->poc.layno1; pi->layno++) { 383 for (pi->layno = pi->poc.layno0; pi->lay no < pi->poc.layno1; pi->layno++) {
381 index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p; 384 index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
382 if (!pi->include[index]) { 385 if (!pi->include[index]) {
383 pi->include[index] = 1; 386 pi->include[index] = 1;
384 return OPJ_TRUE; 387 return OPJ_TRUE;
385 } 388 }
386 LABEL_SKIP:; 389 LABEL_SKIP:;
387 } 390 }
388 } 391 }
389 } 392 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 454
452 if ((res->pw==0)||(res->ph==0)) continue ; 455 if ((res->pw==0)||(res->ph==0)) continue ;
453 456
454 if ((trx0==trx1)||(try0==try1)) continue ; 457 if ((trx0==trx1)||(try0==try1)) continue ;
455 458
456 prci = opj_int_floordivpow2(opj_int_ceil div(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx) 459 prci = opj_int_floordivpow2(opj_int_ceil div(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
457 - opj_int_floordivpow2(trx0, (O PJ_INT32)res->pdx); 460 - opj_int_floordivpow2(trx0, (O PJ_INT32)res->pdx);
458 prcj = opj_int_floordivpow2(opj_int_ceil div(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy) 461 prcj = opj_int_floordivpow2(opj_int_ceil div(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
459 - opj_int_floordivpow2(try0, (O PJ_INT32)res->pdy); 462 - opj_int_floordivpow2(try0, (O PJ_INT32)res->pdy);
460 pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw); 463 pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
464 if (pi->precno >= res->pw * res->ph) {
465 return OPJ_FALSE;
466 }
461 for (pi->layno = pi->poc.layno0; pi->lay no < pi->poc.layno1; pi->layno++) { 467 for (pi->layno = pi->poc.layno0; pi->lay no < pi->poc.layno1; pi->layno++) {
462 index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p; 468 index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
463 if (!pi->include[index]) { 469 if (!pi->include[index]) {
464 pi->include[index] = 1; 470 pi->include[index] = 1;
465 return OPJ_TRUE; 471 return OPJ_TRUE;
466 } 472 }
467 LABEL_SKIP:; 473 LABEL_SKIP:;
468 } 474 }
469 } 475 }
470 } 476 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 536
531 if ((res->pw==0)||(res->ph==0)) continue ; 537 if ((res->pw==0)||(res->ph==0)) continue ;
532 538
533 if ((trx0==trx1)||(try0==try1)) continue ; 539 if ((trx0==trx1)||(try0==try1)) continue ;
534 540
535 prci = opj_int_floordivpow2(opj_int_ceil div(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx) 541 prci = opj_int_floordivpow2(opj_int_ceil div(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
536 - opj_int_floordivpow2(trx0, (O PJ_INT32)res->pdx); 542 - opj_int_floordivpow2(trx0, (O PJ_INT32)res->pdx);
537 prcj = opj_int_floordivpow2(opj_int_ceil div(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy) 543 prcj = opj_int_floordivpow2(opj_int_ceil div(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
538 - opj_int_floordivpow2(try0, (O PJ_INT32)res->pdy); 544 - opj_int_floordivpow2(try0, (O PJ_INT32)res->pdy);
539 pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw); 545 pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
546 if (pi->precno >= res->pw * res->ph) {
547 return OPJ_FALSE;
548 }
540 for (pi->layno = pi->poc.layno0; pi->lay no < pi->poc.layno1; pi->layno++) { 549 for (pi->layno = pi->poc.layno0; pi->lay no < pi->poc.layno1; pi->layno++) {
541 index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p; 550 index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
542 if (!pi->include[index]) { 551 if (!pi->include[index]) {
543 pi->include[index] = 1; 552 pi->include[index] = 1;
544 return OPJ_TRUE; 553 return OPJ_TRUE;
545 } 554 }
546 LABEL_SKIP:; 555 LABEL_SKIP:;
547 } 556 }
548 } 557 }
549 } 558 }
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 case OPJ_PCRL: 1884 case OPJ_PCRL:
1876 return opj_pi_next_pcrl(pi); 1885 return opj_pi_next_pcrl(pi);
1877 case OPJ_CPRL: 1886 case OPJ_CPRL:
1878 return opj_pi_next_cprl(pi); 1887 return opj_pi_next_cprl(pi);
1879 case OPJ_PROG_UNKNOWN: 1888 case OPJ_PROG_UNKNOWN:
1880 return OPJ_FALSE; 1889 return OPJ_FALSE;
1881 } 1890 }
1882 1891
1883 return OPJ_FALSE; 1892 return OPJ_FALSE;
1884 } 1893 }
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