summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/window.cpp b/src/window.cpp
index eb5243f..6072f96 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -4064,18 +4064,22 @@ CompWindow::getIcon (int width,
if (result == Success && data)
{
- CARD32 *p;
- CARD32 alpha, red, green, blue;
- int iw, ih, j;
+ CARD32 *p;
+ CARD32 alpha, red, green, blue;
+ unsigned long iw, ih;
for (i = 0; i + 2 < n; i += iw * ih + 2)
{
unsigned long *idata = (unsigned long *) data;
+ unsigned long j;
iw = idata[i];
ih = idata[i + 1];
- if (iw * ih + 2 > (int) (n - i))
+ /* iw * ih may be larger than the value range of unsigned
+ * long, so better do some checking for extremely weird
+ * icon sizes first */
+ if (iw > 2048 || ih > 2048 || iw * ih + 2 > n - i)
break;
if (iw && ih)