|
@@ -65,6 +65,10 @@ struct pixel_buffer * alloc_pixbuf ( unsigned int width, unsigned int height ) {
|
65
|
65
|
pixbuf->height = height;
|
66
|
66
|
pixbuf->len = ( width * height * sizeof ( uint32_t ) );
|
67
|
67
|
|
|
68
|
+ /* Check for multiplication overflow */
|
|
69
|
+ if ( ( ( pixbuf->len / sizeof ( uint32_t ) ) / width ) != height )
|
|
70
|
+ goto err_overflow;
|
|
71
|
+
|
68
|
72
|
/* Allocate pixel data buffer */
|
69
|
73
|
pixbuf->data = umalloc ( pixbuf->len );
|
70
|
74
|
if ( ! pixbuf->data )
|
|
@@ -73,6 +77,7 @@ struct pixel_buffer * alloc_pixbuf ( unsigned int width, unsigned int height ) {
|
73
|
77
|
return pixbuf;
|
74
|
78
|
|
75
|
79
|
err_alloc_data:
|
|
80
|
+ err_overflow:
|
76
|
81
|
pixbuf_put ( pixbuf );
|
77
|
82
|
err_alloc_pixbuf:
|
78
|
83
|
return NULL;
|