Package: openjpeg2 / 2.3.0-2+deb10u2

CVE-2020-27842.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From fbd30b064f8f9607d500437b6fedc41431fd6cdc Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Tue, 1 Dec 2020 19:51:35 +0100
Subject: [PATCH] opj_t2_encode_packet(): avoid out of bound access of #1294,
 but likely not the proper fix


--- openjpeg2-2.3.0.orig/src/lib/openjp2/t2.c
+++ openjpeg2-2.3.0/src/lib/openjp2/t2.c
@@ -707,6 +707,15 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ
                 continue;
             }
 
+            /* Avoid out of bounds access of https://github.com/uclouvain/openjpeg/issues/1294 */
+            /* but likely not a proper fix. */
+            if (precno >= res->pw * res->ph) {
+                opj_event_msg(p_manager, EVT_ERROR,
+                              "opj_t2_encode_packet(): accessing precno=%u >= %u\n",
+                              precno, res->pw * res->ph);
+                return OPJ_FALSE;
+            }
+
             prc = &band->precincts[precno];
             opj_tgt_reset(prc->incltree);
             opj_tgt_reset(prc->imsbtree);