OSDN Git Service

Gallery2: Fix use of uninitialized stack variables
authorGreg Kaiser <gkaiser@google.com>
Mon, 14 Mar 2016 18:59:52 +0000 (11:59 -0700)
committerGreg Kaiser <gkaiser@google.com>
Mon, 14 Mar 2016 18:59:52 +0000 (11:59 -0700)
In estmateWhiteBox(), we were adding up several variables,
but never initialized them to zero.

Change-Id: Ia77d92faa5150da0a1d7a04839729febefa63f74

jni/filters/wbalance.c

index 2b92b99..7592a42 100644 (file)
@@ -99,10 +99,10 @@ void estmateWhite(unsigned char *src, int len, int *wr, int *wb, int *wg){
 }
 
 void estmateWhiteBox(unsigned char *src, int iw, int ih, int x,int y, int *wr, int *wb, int *wg){
-    int r;
-    int g;
-    int b;
-    int sum;
+    int r = 0;
+    int g = 0;
+    int b = 0;
+    int sum = 0;
     int xp,yp;
     int bounds = 5;
     if (x<0) x = bounds;