ref: da7e8299e145dc5099e2d0f52ba20b117128e1df
parent: 3a2cb7a9bb4037ed2d947f6d81ce1582e3725a34
author: Alex Musolino <alex@musolino.id.au>
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){--
⑨