fix [2448319] out of bounds array index in fog
diff --git a/include/private/pixelflinger/ggl_context.h b/include/private/pixelflinger/ggl_context.h
index 8a36fa9..2d7fdcf 100644
--- a/include/private/pixelflinger/ggl_context.h
+++ b/include/private/pixelflinger/ggl_context.h
@@ -285,8 +285,7 @@
};
struct fog_state_t {
- uint8_t color[3];
- uint8_t reserved;
+ uint8_t color[4];
};
struct logic_op_state_t {
diff --git a/libpixelflinger/pixelflinger.cpp b/libpixelflinger/pixelflinger.cpp
index b54da0c..84e584e 100644
--- a/libpixelflinger/pixelflinger.cpp
+++ b/libpixelflinger/pixelflinger.cpp
@@ -281,6 +281,7 @@
const int32_t r = gglClampx(color[0]);
const int32_t g = gglClampx(color[1]);
const int32_t b = gglClampx(color[2]);
+ c->state.fog.color[GGLFormat::ALPHA]= 0xFF; // unused
c->state.fog.color[GGLFormat::RED] = (r - (r>>8))>>8;
c->state.fog.color[GGLFormat::GREEN]= (g - (g>>8))>>8;
c->state.fog.color[GGLFormat::BLUE] = (b - (b>>8))>>8;