Blame SOURCES/jasper-1.900.1-Coverity-FORWARD_NULL.patch

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