]> git.lizzy.rs Git - plan9front.git/commitdiff
ico: fix interpretation of 0 widths/heights
authorAlex Musolino <alex@musolino.id.au>
Tue, 15 Dec 2020 10:14:11 +0000 (20:44 +1030)
committerAlex Musolino <alex@musolino.id.au>
Tue, 15 Dec 2020 10:14:11 +0000 (20:44 +1030)
sys/src/cmd/jpg/ico.c

index ea7ba9a7ea41311f8b7b3d094d61a0cb0527c934..7fb270ed3398225e21ff68bd70502bd360b55b1f 100644 (file)
@@ -13,8 +13,8 @@ struct Icon
 {
        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 */
@@ -269,6 +269,11 @@ Bgeticon(Biobuf *b, Icon *icon)
        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){
        case 1: