Skip to content

Commit

Permalink
Don't crash on empty images.
Browse files Browse the repository at this point in the history
In ROOFTOPS.DAT for example.
  • Loading branch information
NagyD committed Sep 17, 2017
1 parent d24cc30 commit 010c4b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/object/image/image16.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes)

int imageSizeInBytes=0;
int result;


if (dataSizeInBytes < 6) return COMPRESS_RESULT_FATAL; // Empty images are only 2 bytes: 00 00.

image->height=array2short(data);
data+=2;
image->width =array2short(data);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/object/image/image256.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ int mExpandGraphic256(const unsigned char* data,tImage *image, int dataSizeInByt

int imageSizeInBytes=0;

if (dataSizeInBytes < 6) return COMPRESS_RESULT_FATAL; // Empty images are only 2 bytes: 00 00.

image->height=array2short(data);
data+=2;
image->width =array2short(data);
Expand Down

0 comments on commit 010c4b0

Please sign in to comment.