Skip to content

Commit

Permalink
fixed memory corruption in fallback PCX palette; this fixes #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Szabo committed Feb 27, 2018
1 parent 8e6d4a8 commit 22bb390
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion in_pcx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static Image::Sampled *LoadPCX
if (fread(pinfo->pal, 1, colors*3, fp) != colors * 3 + 0U ||
ferror(fp) || feof(fp)) {
pcxError(bname,"Error reading PCX colormap. Using grayscale.");
for (i=0; i<256; i++) PAL_R(pinfo,i) = PAL_G(pinfo,i) = PAL_B(pinfo,i) = i;
for (i=0; i<colors; i++) PAL_R(pinfo,i) = PAL_G(pinfo,i) = PAL_B(pinfo,i) = i;
}
}
else if (colors<=16) { /* internal colormap */
Expand Down

0 comments on commit 22bb390

Please sign in to comment.