mirror of
https://github.com/gryf/wmaker.git
synced 2026-11-20 06:06:55 +01:00
wrlib: check RCreateImage() result in RMakeTiledImage()
When the requested size is larger than the tile, RMakeTiledImage() creates a new image with RCreateImage() and immediately writes to image->data. RCreateImage() returns NULL when the allocation fails or when the dimensions exceed its limit (20000 pixels), so a very large background texture, or memory pressure, makes the caller crash instead of getting an error. The other branches of this function already return NULL on failure (RCloneImage() and RGetSubImage()), and the callers handle a NULL result, so return NULL here as well. Signed-off-by: Haroldo Santos <haroldo.santos@gmail.com>
This commit is contained in:
1 parent
c0104d56bf
commit
0dd8b6a099
1 file changed
+2
@@ -578,6 +578,8 @@ RImage *RMakeTiledImage(RImage * tile, unsigned width, unsigned height)
|
||||
int has_alpha = HAS_ALPHA(tile);
|
||||
|
||||
image = RCreateImage(width, height, has_alpha);
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
d = image->data;
|
||||
s = tile->data;
|
||||
|
||||
Reference in new issue
Block a user