mirror of
https://github.com/gryf/wmaker.git
synced 2026-07-07 19:26:39 +02:00
Compare commits
2 Commits
931186bd18
...
aa7287efbf
| Author | SHA1 | Date | |
|---|---|---|---|
| aa7287efbf | |||
| 5eb3287535 |
+12
-4
@@ -408,6 +408,8 @@ static RImage *makeRImageFromARGBData(unsigned long *data)
|
||||
return NULL;
|
||||
|
||||
image = RCreateImage(width, height, True);
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
for (imgdata = image->data, i = 2; i < size + 2; i++, imgdata += 4) {
|
||||
pixel = data[i];
|
||||
@@ -458,9 +460,11 @@ static RImage *findBestIcon(unsigned long *data, unsigned long items)
|
||||
/* get the current icon's size */
|
||||
sx = (int)data[i];
|
||||
sy = (int)data[i + 1];
|
||||
if ((sx < 1) || (sy < 1))
|
||||
if (sx < 1 || sy < 1 || sx > 4096 || sy > 4096)
|
||||
break;
|
||||
size = (unsigned long)sx * (unsigned long)sy + 2;
|
||||
if ((unsigned long)size > items - i)
|
||||
break;
|
||||
size = sx * sy + 2;
|
||||
|
||||
/* check the size difference if it's not too large */
|
||||
if ((sx <= wanted) && (sy <= wanted)) {
|
||||
@@ -485,8 +489,12 @@ static RImage *findBestIcon(unsigned long *data, unsigned long items)
|
||||
* small image by a small scale. */
|
||||
largest = 0;
|
||||
for (i = 0L; i < items - 1;) {
|
||||
size = (int)data[i] * (int)data[i + 1];
|
||||
if (size == 0)
|
||||
sx = (int)data[i];
|
||||
sy = (int)data[i + 1];
|
||||
if (sx < 1 || sy < 1 || sx > 4096 || sy > 4096)
|
||||
break;
|
||||
size = (unsigned long)sx * (unsigned long)sy;
|
||||
if ((unsigned long)size + 2 > items - i)
|
||||
break;
|
||||
if (size > largest) {
|
||||
icon = &data[i];
|
||||
|
||||
Reference in New Issue
Block a user