jasper/jasper-1.900.1-Coverity-NULL_RETURNS.patch

62 lines
3.0 KiB
Diff
Raw Normal View History

Error: NULL_RETURNS
base/jas_image.c:213: returned_null: Function "jas_image_create0" returns null (checked 6 out of 7 times).
base/jas_image.c:213: var_assigned: Assigning: "newimage" = null return value from "jas_image_create0".
base/jas_image.c:214: dereference: Dereferencing a pointer that might be null "newimage" when calling "jas_image_growcmpts".
base/jas_image.c:777: deref_parm: Directly dereferencing parameter "image".
base/jas_seq.c:223: returned_null: Function "jas_malloc" returns null (checked 110 out of 119 times).
base/jas_seq.c:223: var_assigned: Assigning: "mat0->rows_" = null return value from "jas_malloc".
base/jas_seq.c:225: dereference: Dereferencing a null pointer "mat0->rows_".
jp2/jp2_cod.c:484: returned_null: Function "jas_stream_memopen" returns null (checked 12 out of 15 times).
jp2/jp2_cod.c:484: var_assigned: Assigning: "tmpstream" = null return value from "jas_stream_memopen".
jp2/jp2_cod.c:490: dereference: Dereferencing a pointer that might be null "tmpstream" when calling "jas_stream_tell".
base/jas_stream.c:677: deref_parm: Directly dereferencing parameter "stream".
diff -up jasper-1.900.1/src/libjasper/base/jas_image.c.NULL_RETURNS jasper-1.900.1/src/libjasper/base/jas_image.c
--- jasper-1.900.1/src/libjasper/base/jas_image.c.NULL_RETURNS 2011-12-08 14:00:05.350020869 +0100
+++ jasper-1.900.1/src/libjasper/base/jas_image.c 2011-12-08 14:00:06.638004766 +0100
@@ -210,7 +210,10 @@ jas_image_t *jas_image_copy(jas_image_t
jas_image_t *newimage;
int cmptno;
- newimage = jas_image_create0();
+ if (!(newimage = jas_image_create0())) {
+ goto error;
+ }
+
if (jas_image_growcmpts(newimage, image->numcmpts_)) {
goto error;
}
diff -up jasper-1.900.1/src/libjasper/base/jas_seq.c.NULL_RETURNS jasper-1.900.1/src/libjasper/base/jas_seq.c
--- jasper-1.900.1/src/libjasper/base/jas_seq.c.NULL_RETURNS 2011-12-08 14:00:05.000000000 +0100
+++ jasper-1.900.1/src/libjasper/base/jas_seq.c 2011-12-08 14:15:12.449680562 +0100
@@ -220,7 +220,11 @@ void jas_matrix_bindsub(jas_matrix_t *ma
mat0->numrows_ = r1 - r0 + 1;
mat0->numcols_ = c1 - c0 + 1;
mat0->maxrows_ = mat0->numrows_;
- mat0->rows_ = jas_alloc2(mat0->maxrows_, sizeof(jas_seqent_t *));
+ if (!(mat0->rows_ = jas_alloc2(mat0->maxrows_, sizeof(jas_seqent_t *)))) {
+ jas_matrix_destroy(mat0);
+ return;
+ }
+
for (i = 0; i < mat0->numrows_; ++i) {
mat0->rows_[i] = mat1->rows_[r0 + i] + c0;
}
diff -up jasper-1.900.1/src/libjasper/jp2/jp2_cod.c.NULL_RETURNS jasper-1.900.1/src/libjasper/jp2/jp2_cod.c
--- jasper-1.900.1/src/libjasper/jp2/jp2_cod.c.NULL_RETURNS 2011-12-08 14:00:05.633017331 +0100
+++ jasper-1.900.1/src/libjasper/jp2/jp2_cod.c 2011-12-08 14:00:06.677004279 +0100
@@ -481,7 +481,9 @@ int jp2_box_put(jp2_box_t *box, jas_stre
dataflag = !(box->info->flags & (JP2_BOX_SUPER | JP2_BOX_NODATA));
if (dataflag) {
- tmpstream = jas_stream_memopen(0, 0);
+ if (!(tmpstream = jas_stream_memopen(0, 0))) {
+ goto error;
+ }
if (box->ops->putdata) {
if ((*box->ops->putdata)(box, tmpstream)) {
goto error;