0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

updated for version 7.3.428

Problem:    Win32: an xpm file without a mask crashes Vim.
Solution:   Fail when the mask is missing. (Dave Bodenstab)
This commit is contained in:
Bram Moolenaar
2012-02-05 00:48:00 +01:00
parent a489e1d9d6
commit e37c611012
2 changed files with 16 additions and 9 deletions

View File

@@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
428,
/**/ /**/
427, 427,
/**/ /**/

View File

@@ -1,4 +1,5 @@
/* /* vi:set ts=8 sts=4 sw=4:
*
* Load XPM image. * Load XPM image.
* *
* This function is placed in separate file because Xpm headers conflict with * This function is placed in separate file because Xpm headers conflict with
@@ -30,9 +31,10 @@
#include "xpm.h" #include "xpm.h"
/* /*
* Tries to load Xpm image from file 'filename'. * Tries to load an Xpm image from the file "filename".
* If fails return -1. * Returns -1 on failure.
* success - 0 and image and mask BITMAPS * Returns 0 on success and stores image and mask BITMAPS in "hImage" and
* "hShape".
*/ */
int int
LoadXpmImage(filename, hImage, hShape) LoadXpmImage(filename, hImage, hShape)
@@ -40,7 +42,7 @@ LoadXpmImage(filename, hImage, hShape)
HBITMAP *hImage; HBITMAP *hImage;
HBITMAP *hShape; HBITMAP *hShape;
{ {
XImage *img; /* loaded image */ XImage *img; /* loaded image */
XImage *shp; /* shapeimage */ XImage *shp; /* shapeimage */
XpmAttributes attr; XpmAttributes attr;
int res; int res;
@@ -51,10 +53,13 @@ LoadXpmImage(filename, hImage, hShape)
DeleteDC(hdc); DeleteDC(hdc);
if (res < 0) if (res < 0)
return -1; return -1;
else if (shp == NULL)
{ {
*hImage = img->bitmap; if (img)
*hShape = shp->bitmap; XDestroyImage(img);
return 0; return -1;
} }
*hImage = img->bitmap;
*hShape = shp->bitmap;
return 0;
} }