ref: 81647c202550634b99c2bc93dd055b8d54725abf
parent: 5d790e08ca051d74f2146014a4426bbc217680e8
author: Alex Musolino <[email protected]>
date: Tue Dec 15 15:44:11 EST 2020
ico: fix interpretation of 0 widths/heights
--- a/sys/src/cmd/jpg/ico.c
+++ b/sys/src/cmd/jpg/ico.c
@@ -13,8 +13,8 @@
{
Icon *next;
- uchar w; /* icon width */
- uchar h; /* icon height */
+ ushort w; /* icon width */
+ ushort h; /* icon height */
ushort ncolor; /* number of colors */
ushort nplane; /* number of bit planes */
ushort bits; /* bits per pixel */
@@ -268,6 +268,11 @@
icon->h = getl(buf+8)>>1;
icon->nplane = gets(buf+12);
icon->bits = gets(buf+14);
+
+ if(icon->w == 0)
+ icon->w = 256;
+ if(icon->h == 0)
+ icon->h = 256;
/* limit what we handle */
switch(icon->bits){