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