Skip to content
Permalink
Browse files Browse the repository at this point in the history
pict,macrsrc: Fixed a bug that could cause division by 0
Found by F. Çelik.
  • Loading branch information
jsummers committed Mar 14, 2021
1 parent deb0c97 commit 62acb77
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fmtutil.c
Expand Up @@ -1618,7 +1618,9 @@ void fmtutil_macbitmap_read_pixmap_only_fields(deark *c, dbuf *f, struct fmtutil
de_dbg(c, "pixel type=%d, bits/pixel=%d, components/pixel=%d, bits/comp=%d",
(int)bi->pixeltype, (int)bi->pixelsize, (int)bi->cmpcount, (int)bi->cmpsize);

bi->pdwidth = (bi->rowbytes*8)/bi->pixelsize;
if(bi->pixelsize>0) {
bi->pdwidth = (bi->rowbytes*8)/bi->pixelsize;
}
if(bi->pdwidth < bi->npwidth) {
bi->pdwidth = bi->npwidth;
}
Expand Down

0 comments on commit 62acb77

Please sign in to comment.