jasper/jasper-1.900.1-Coverity-FORWARD_NULL.patch
Jiri Popelka c73923e32e CVE-2011-4516, CVE-2011-4517, CERT VU#887409 (#765660)
Fixed problems found by static analysis of code (#761440)
2011-12-09 12:44:44 +01:00

45 lines
1.9 KiB
Diff

Error: FORWARD_NULL
jpc/jpc_dec.c:2207: var_compare_op: Comparing "streams" to null implies that "streams" might be null.
jpc/jpc_dec.c:2270: var_deref_model: Passing null variable "streams" to function "jpc_streamlist_destroy", which dereferences it.
jpc/jpc_dec.c:2108: deref_parm: Directly dereferencing parameter "streamlist".
jpc/jpc_t1enc.c:225: assign_zero: Assigning: "cblk->passes" = 0.
jpc/jpc_t1enc.c:228: alias_transfer: Assigning null: "pass" = "cblk->passes".
jpc/jpc_t1enc.c:229: var_deref_op: Dereferencing null variable "pass".
diff -up jasper-1.900.1/src/libjasper/jpc/jpc_dec.c.forward_null jasper-1.900.1/src/libjasper/jpc/jpc_dec.c
--- jasper-1.900.1/src/libjasper/jpc/jpc_dec.c.forward_null 2007-01-19 22:43:07.000000000 +0100
+++ jasper-1.900.1/src/libjasper/jpc/jpc_dec.c 2011-06-24 15:01:39.200600146 +0200
@@ -2267,7 +2267,9 @@ jpc_streamlist_t *jpc_ppmstabtostreams(j
return streams;
error:
- jpc_streamlist_destroy(streams);
+ if (streams) {
+ jpc_streamlist_destroy(streams);
+ }
return 0;
}
diff -up jasper-1.900.1/src/libjasper/jpc/jpc_t1enc.c.forward_null jasper-1.900.1/src/libjasper/jpc/jpc_t1enc.c
--- jasper-1.900.1/src/libjasper/jpc/jpc_t1enc.c.forward_null 2007-01-19 22:43:07.000000000 +0100
+++ jasper-1.900.1/src/libjasper/jpc/jpc_t1enc.c 2011-06-24 14:58:33.061248133 +0200
@@ -224,7 +224,7 @@ int jpc_enc_enccblk(jpc_enc_t *enc, jas_
} else {
cblk->passes = 0;
}
- endpasses = &cblk->passes[cblk->numpasses];
+ endpasses = (cblk->passes) ? &cblk->passes[cblk->numpasses] : 0;
for (pass = cblk->passes; pass != endpasses; ++pass) {
pass->start = 0;
pass->end = 0;
@@ -352,7 +352,7 @@ dump_passes(cblk->passes, cblk->numpasse
#endif
n = 0;
- endpasses = &cblk->passes[cblk->numpasses];
+ endpasses = (cblk->passes) ? &cblk->passes[cblk->numpasses] : 0;
for (pass = cblk->passes; pass != endpasses; ++pass) {
if (pass->start < n) {
pass->start = n;