Skip to content

Commit

Permalink
correct RLE unpack algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Feb 14, 2023
1 parent 59eb784 commit 26bf171
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions coders/wpg.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
% June 2000 %
% %
% %
% Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization %
% Copyright 1999 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
Expand Down Expand Up @@ -530,19 +530,17 @@ static int UnpackWPGRaster(Image *image,int bpp)
}
for(i=0;i < (int) RunCount;i++)
{
x=0;
y++; /* Here I need to duplicate previous row RUNCOUNT* */
if(y<2) continue;
if(y>(ssize_t) image->rows)
if(y > = (ssize_t) image->rows)
{
BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);
return(-4);
}
if (InsertRow(BImgBuff,y-1,image,bpp) == MagickFalse)
{
BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);
return(-5);
return(-6);
}
y++;
}
}
}
Expand Down

0 comments on commit 26bf171

Please sign in to comment.