Skip to content

Commit

Permalink
Corrected setting the offset for the seek operation to fix issue when…
Browse files Browse the repository at this point in the history
… reading xbm files with information between the width/height define and data.
  • Loading branch information
dlemstra committed Jun 19, 2024
1 parent 545d71c commit 38b0c24
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions coders/xbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,25 +266,23 @@ static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
if (sscanf(buffer,"static short %1024s = {",name) == 1)
version=10;
else if (sscanf(buffer,"static unsigned char %s = {",name) == 1)
version=11;
else if (sscanf(buffer,"static char %1024s = {",name) == 1)
version=11;
else
if (sscanf(buffer,"static unsigned char %s = {",name) == 1)
version=11;
else
if (sscanf(buffer,"static char %1024s = {",name) == 1)
version=11;
else
continue;
{
offset=TellBlob(image);
continue;
}
p=(unsigned char *) strrchr(name,'_');
if (p == (unsigned char *) NULL)
p=(unsigned char *) name;
else
p++;
if (LocaleCompare("bits[]",(char *) p) == 0)
break;
offset=TellBlob(image);
}
if (strchr(buffer,'{') != (char *) NULL)
(void) SeekBlob(image,offset+(strchr(buffer,'{')-buffer)+1,SEEK_SET);
/*
Initialize image structure.
*/
Expand All @@ -310,6 +308,9 @@ static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
p=(unsigned char *) strrchr(buffer,'{');
if (p != (unsigned char *) NULL)
(void) SeekBlob(image,offset+((char *) p-buffer)+1,SEEK_SET);
/*
Initialize hex values.
*/
Expand Down

0 comments on commit 38b0c24

Please sign in to comment.