[libcamera-devel] [PATCH 3/4] ipa: raspberrypi: fix access to uninitialized variables

Tomi Valkeinen tomi.valkeinen at iki.fi
Wed Oct 7 13:07:42 CEST 2020


Set span_r and span_b to -1 so that when they are passed to Pwl::Eval()
they won't cause access to uninitialized memory.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen at iki.fi>
---
 src/ipa/raspberrypi/controller/rpi/awb.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp
index a5536e4..469d0e5 100644
--- a/src/ipa/raspberrypi/controller/rpi/awb.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp
@@ -430,7 +430,7 @@ double Awb::coarseSearch(Pwl const &prior)
 
 void Awb::fineSearch(double &t, double &r, double &b, Pwl const &prior)
 {
-	int span_r, span_b;
+	int span_r = -1, span_b = -1;
 	config_.ct_r.Eval(t, &span_r);
 	config_.ct_b.Eval(t, &span_b);
 	double step = t / 10 * config_.coarse_step * 0.1;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



More information about the libcamera-devel mailing list