XPM loader: Add missing pixels (malformed xpm)

If there are not enough pixels in the image data just fill in the first
color.

This way we will proceed without uninitialized pixel data avoiding
valgrind complaints.
This commit is contained in:
Kim Woelders 2018-07-21 11:35:06 +02:00
parent 49a67a8f9c
commit 6ea4cf7e66
1 changed files with 7 additions and 0 deletions

View File

@ -431,6 +431,13 @@ load(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity,
done = 1;
}
for (; count < pixels; count++)
{
/* Fill in missing pixels
* (avoid working with uninitialized data in bad xpms) */
im->data[count] = cmap[0].pixel;
}
if (transp >= 0)
{
SET_FLAG(im->flags, F_HAS_ALPHA);