summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/pixbuf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/pixbuf.c b/src/core/pixbuf.c
index 4742d285..641a0fb5 100644
--- a/src/core/pixbuf.c
+++ b/src/core/pixbuf.c
@@ -68,8 +68,10 @@ struct pixel_buffer * alloc_pixbuf ( unsigned int width, unsigned int height ) {
pixbuf->len = ( width * height * sizeof ( uint32_t ) );
/* Check for multiplication overflow */
- if ( ( ( pixbuf->len / sizeof ( uint32_t ) ) / width ) != height )
+ if ( ( width != 0 ) &&
+ ( ( pixbuf->len / sizeof ( uint32_t ) ) / width ) != height ) {
goto err_overflow;
+ }
/* Allocate pixel data buffer */
pixbuf->data = umalloc ( pixbuf->len );