diff options
author | Alex Musolino <alex@musolino.id.au> | 2020-12-15 20:44:11 +1030 |
---|---|---|
committer | Alex Musolino <alex@musolino.id.au> | 2020-12-15 20:44:11 +1030 |
commit | 81647c202550634b99c2bc93dd055b8d54725abf (patch) | |
tree | dec197357b95522f78de8fb333cd665effdfeb48 | |
parent | 5d790e08ca051d74f2146014a4426bbc217680e8 (diff) | |
download | plan9front-81647c202550634b99c2bc93dd055b8d54725abf.tar.xz |
ico: fix interpretation of 0 widths/heights
-rw-r--r-- | sys/src/cmd/jpg/ico.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/src/cmd/jpg/ico.c b/sys/src/cmd/jpg/ico.c index ea7ba9a7e..7fb270ed3 100644 --- a/sys/src/cmd/jpg/ico.c +++ b/sys/src/cmd/jpg/ico.c @@ -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: |