fix null pointer dereferences
authorMike Erwin <significant.bit@gmail.com>
Thu, 21 Jul 2016 22:15:54 +0000 (18:15 -0400)
committerMike Erwin <significant.bit@gmail.com>
Thu, 21 Jul 2016 22:16:08 +0000 (18:16 -0400)
Found with PVS-Studio T48917

source/blender/blenkernel/intern/tracking_util.c
source/blender/freestyle/intern/view_map/Functions1D.cpp

index a40e4f726366b7d83c91ed1cc47837be81fc7528..a90b1dee927abfb0a34596f65aab5b6365789339 100644 (file)
@@ -762,8 +762,8 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor,
                        final_ibuf = IMB_dupImBuf(orig_ibuf);
                }
                IMB_scaleImBuf(final_ibuf,
-                              ibuf->x / (1 << downscale),
-                              ibuf->y / (1 << downscale));
+                              orig_ibuf->x / (1 << downscale),
+                              orig_ibuf->y / (1 << downscale));
        }
 
        if (transform != NULL) {
@@ -780,7 +780,7 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor,
        }
 
        if (input_mode == LIBMV_IMAGE_MODE_RGBA) {
-               BLI_assert(ibuf->channels == 3 || ibuf->channels == 4);
+               BLI_assert(orig_ibuf->channels == 3 || orig_ibuf->channels == 4);
                /* pass */
        }
        else /* if (input_mode == LIBMV_IMAGE_MODE_MONO) */ {
index 11e0cc37d4da451004639cc61b70bdfdbb44a602..8f16f78cb10fe1566b1b7063d5d37072c5ab880e 100644 (file)
@@ -104,7 +104,7 @@ int QuantitativeInvisibilityF1D::operator()(Interface1D& inter)
        }
        FEdge *fe = dynamic_cast<FEdge*>(&inter);
        if (fe) {
-               result = ve->qi();
+               result = fe->qi();
                return 0;
        }
        result = integrate(_func, inter.verticesBegin(), inter.verticesEnd(), _integration);