Skip to content

Commit

Permalink
bugfix: fixed BMP loading when pixel data is too long (ypos < 0); this
Browse files Browse the repository at this point in the history
…fixes #24
  • Loading branch information
Peter Szabo committed Feb 27, 2018
1 parent 1e43ec5 commit 118cb81
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions input-bmp.ci
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ ReadImage (FILE *fd,
*(temp++)= buffer[xpos * 4 + 1];
*(temp++)= buffer[xpos * 4];
}
--ypos; /* next line */
if (ypos-- == 0) break; /* next line */
}
}
break;
Expand All @@ -335,7 +335,7 @@ ReadImage (FILE *fd,
*(temp++)= buffer[xpos * 3 + 1];
*(temp++)= buffer[xpos * 3];
}
--ypos; /* next line */
if (ypos-- == 0) break; /* next line */
}
}
break;
Expand All @@ -352,7 +352,7 @@ ReadImage (FILE *fd,
*(temp++)= (unsigned char)(((rgb >> 5) & 0x1f) * 8);
*(temp++)= (unsigned char)(((rgb) & 0x1f) * 8);
}
--ypos; /* next line */
if (ypos-- == 0) break; /* next line */
}
}
break;
Expand All @@ -378,12 +378,9 @@ ReadImage (FILE *fd,
if (xpos == width)
{
if (!ReadOK (fd, buffer, rowpad)) break;
ypos--;
if (ypos-- == 0) break; /* next line */
xpos = 0;

}
if ((int)ypos < 0)
break;
}
break;
}
Expand Down

0 comments on commit 118cb81

Please sign in to comment.