diff options
| author | Matthieu Darbois <mayeut@users.noreply.github.com> | 2016-04-28 13:16:43 +0200 |
|---|---|---|
| committer | Matthieu Darbois <mayeut@users.noreply.github.com> | 2016-04-28 13:16:43 +0200 |
| commit | 29313eb5f1b2c01c7493087fa2d8f1a20495a34e (patch) | |
| tree | 8692044fc432188990ac74aa0aef440321cbb12d /src/lib/openjp2/pi.c | |
| parent | e982d0396607a16ca0c373020cc93449504eb4e8 (diff) | |
Fix unsigned int overflow reported by UBSan (#761)
* Fix unsigned int overflow reported by UBSan
Please add -DOPJ_UBSAN_BUILD to CFLAGS when building with
-fsanitize=undefined,unsigned-integer-overflow
It seems clang/gcc do not allow to disable checking for block of code
other than function or file.
Diffstat (limited to 'src/lib/openjp2/pi.c')
| -rw-r--r-- | src/lib/openjp2/pi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/openjp2/pi.c b/src/lib/openjp2/pi.c index bfee10a2..cffad668 100644 --- a/src/lib/openjp2/pi.c +++ b/src/lib/openjp2/pi.c @@ -747,10 +747,12 @@ static void opj_get_all_encoding_parameters( const opj_image_t *p_image, } /* use custom size for precincts*/ - l_level_no = l_tccp->numresolutions - 1; + l_level_no = l_tccp->numresolutions; for (resno = 0; resno < l_tccp->numresolutions; ++resno) { OPJ_UINT32 l_dx, l_dy; + --l_level_no; + /* precinct width and height*/ l_pdx = l_tccp->prcw[resno]; l_pdy = l_tccp->prch[resno]; @@ -782,7 +784,6 @@ static void opj_get_all_encoding_parameters( const opj_image_t *p_image, *p_max_prec = l_product; } - --l_level_no; } ++l_tccp; ++l_img_comp; |
