File jasper-CVE-2021-3272.patch of Package jasper (Revision 37c31914e47246a388341809ec31d106)
Currently displaying revision 37c31914e47246a388341809ec31d106 , Show latest
38
1
Index: jasper-2.0.14/src/libjasper/jp2/jp2_dec.c
2
===================================================================
3
--- jasper-2.0.14.orig/src/libjasper/jp2/jp2_dec.c
4
+++ jasper-2.0.14/src/libjasper/jp2/jp2_dec.c
5
6
with the data in the code stream? */
7
if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||
8
(!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {
9
- jas_eprintf("warning: component data type mismatch\n");
10
+ jas_eprintf("warning: component data type mismatch (IHDR)\n");
11
}
12
13
/* Is the compression type supported? */
14
15
++i) {
16
if (jas_image_cmptdtype(dec->image, i) !=
17
JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {
18
- jas_eprintf("warning: component data type mismatch\n");
19
+ jas_eprintf("warning: component data type mismatch (BPCC)\n");
20
}
21
}
22
} else {
23
24
}
25
}
26
27
+ /* Ensure that the number of channels being used by the decoder
28
+ * matches the number of image components. */
29
+ if (dec->numchans != jas_image_numcmpts(dec->image)) {
30
+ jas_eprintf("error: mismatch in number of components (%d != %d)\n",
31
+ dec->numchans, jas_image_numcmpts(dec->image));
32
+ goto error;
33
+ }
34
+
35
/* Mark all components as being of unknown type. */
36
37
for (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {
38