From: Matthew Fernandez Date: Sun, 3 Apr 2022 19:56:15 +0000 (-0700) Subject: GDK plugin gdk_format: squash -Wsign-conversion warnings X-Git-Tag: 4.0.0~126^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c1dcba1daf513e7101b5fab00759c0e9b55c5e3;p=graphviz GDK plugin gdk_format: squash -Wsign-conversion warnings --- diff --git a/plugin/gdk/gvdevice_gdk.c b/plugin/gdk/gvdevice_gdk.c index 15ebb0568..0e278d34a 100644 --- a/plugin/gdk/gvdevice_gdk.c +++ b/plugin/gdk/gvdevice_gdk.c @@ -9,9 +9,11 @@ *************************************************************************/ #include "config.h" +#include #include #include #include +#include #ifdef HAVE_PANGOCAIRO #include @@ -87,14 +89,17 @@ static void gdk_format(GVJ_t * job) argb2rgba(job->width, job->height, job->imagedata); + assert(job->width <= (unsigned)INT_MAX / 4 && "width out of range"); + assert(job->height <= (unsigned)INT_MAX && "height out of range"); + pixbuf = gdk_pixbuf_new_from_data( (unsigned char*)(job->imagedata), // data GDK_COLORSPACE_RGB, // colorspace TRUE, // has_alpha 8, // bits_per_sample - job->width, // width - job->height, // height - 4 * job->width, // rowstride + (int)job->width, // width + (int)job->height, // height + 4 * (int)job->width, // rowstride NULL, // destroy_fn NULL // destroy_fn_data );