Merge pull request #1496 from rouault/fix_1480
authorEven Rouault <even.rouault@spatialys.com>
Fri, 8 Dec 2023 16:23:24 +0000 (17:23 +0100)
committerGitHub <noreply@github.com>
Fri, 8 Dec 2023 16:23:24 +0000 (17:23 +0100)
opj_tcd_dc_level_shift_decode(): avoid increment nullptr (fixes #1480)

src/lib/openjp2/tcd.c

index 55e9a088c2a1f9e0788db86c1a5603048a0a565b..687aa61bb094fb302f1099183e11bc35d3b58879 100644 (file)
@@ -2315,6 +2315,9 @@ static OPJ_BOOL opj_tcd_dc_level_shift_decode(opj_tcd_t *p_tcd)
             l_max = (OPJ_INT32)((1U << l_img_comp->prec) - 1);
         }
 
+        if (l_width == 0 || l_height == 0) {
+            continue;
+        }
 
         if (l_tccp->qmfbid == 1) {
             for (j = 0; j < l_height; ++j) {