idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
600
image_draw_decide_cb (int image_id, void *data) { return (image_id == GPOINTER_TO_INT (data)); }
DoS Exec Code Overflow Mem. Corr.
0
image_draw_decide_cb (int image_id, void *data) { return (image_id == GPOINTER_TO_INT (data)); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
601
poppler_annot_mapping_copy (PopplerAnnotMapping *mapping) { PopplerAnnotMapping *new_mapping; new_mapping = poppler_annot_mapping_new (); *new_mapping = *mapping; if (mapping->annot) new_mapping->annot = (PopplerAnnot *) g_object_ref (mapping->annot); return new_mapping; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_annot_mapping_copy (PopplerAnnotMapping *mapping) { PopplerAnnotMapping *new_mapping; new_mapping = poppler_annot_mapping_new (); *new_mapping = *mapping; if (mapping->annot) new_mapping->annot = (PopplerAnnot *) g_object_ref (mapping->annot); return new_mapping; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
602
poppler_annot_mapping_free (PopplerAnnotMapping *mapping) { if (!mapping) return; if (mapping->annot) g_object_unref (mapping->annot); g_free (mapping); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_annot_mapping_free (PopplerAnnotMapping *mapping) { if (!mapping) return; if (mapping->annot) g_object_unref (mapping->annot); g_free (mapping); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
603
poppler_annot_mapping_new (void) { return (PopplerAnnotMapping *) g_new0 (PopplerAnnotMapping, 1); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_annot_mapping_new (void) { return (PopplerAnnotMapping *) g_new0 (PopplerAnnotMapping, 1); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
604
poppler_color_copy (PopplerColor *color) { PopplerColor *new_color; new_color = g_new (PopplerColor, 1); *new_color = *color; return new_color; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_color_copy (PopplerColor *color) { PopplerColor *new_color; new_color = g_new (PopplerColor, 1); *new_color = *color; return new_color; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
605
poppler_form_field_mapping_free (PopplerFormFieldMapping *mapping) { if (!mapping) return; if (mapping->field) g_object_unref (mapping->field); g_free (mapping); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_form_field_mapping_free (PopplerFormFieldMapping *mapping) { if (!mapping) return; if (mapping->field) g_object_unref (mapping->field); g_free (mapping); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
606
poppler_form_field_mapping_new (void) { return (PopplerFormFieldMapping *) g_new0 (PopplerFormFieldMapping, 1); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_form_field_mapping_new (void) { return (PopplerFormFieldMapping *) g_new0 (PopplerFormFieldMapping, 1); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
607
poppler_image_mapping_copy (PopplerImageMapping *mapping) { PopplerImageMapping *new_mapping; new_mapping = poppler_image_mapping_new (); *new_mapping = *mapping; return new_mapping; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_image_mapping_copy (PopplerImageMapping *mapping) { PopplerImageMapping *new_mapping; new_mapping = poppler_image_mapping_new (); *new_mapping = *mapping; return new_mapping; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
608
poppler_image_mapping_free (PopplerImageMapping *mapping) { g_free (mapping); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_image_mapping_free (PopplerImageMapping *mapping) { g_free (mapping); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
609
poppler_image_mapping_new (void) { return (PopplerImageMapping *) g_new0 (PopplerImageMapping, 1); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_image_mapping_new (void) { return (PopplerImageMapping *) g_new0 (PopplerImageMapping, 1); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
610
poppler_link_mapping_copy (PopplerLinkMapping *mapping) { PopplerLinkMapping *new_mapping; new_mapping = poppler_link_mapping_new (); *new_mapping = *mapping; if (new_mapping->action) new_mapping->action = poppler_action_copy (new_mapping->action); return new_mapping; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_link_mapping_copy (PopplerLinkMapping *mapping) { PopplerLinkMapping *new_mapping; new_mapping = poppler_link_mapping_new (); *new_mapping = *mapping; if (new_mapping->action) new_mapping->action = poppler_action_copy (new_mapping->action); return new_mapping; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
611
poppler_link_mapping_free (PopplerLinkMapping *mapping) { if (mapping->action) poppler_action_free (mapping->action); g_free (mapping); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_link_mapping_free (PopplerLinkMapping *mapping) { if (mapping->action) poppler_action_free (mapping->action); g_free (mapping); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
612
poppler_link_mapping_new (void) { return (PopplerLinkMapping *) g_new0 (PopplerLinkMapping, 1); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_link_mapping_new (void) { return (PopplerLinkMapping *) g_new0 (PopplerLinkMapping, 1); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
613
poppler_mapping_free (PopplerLinkMapping *mapping) { poppler_action_free (mapping->action); g_free (mapping); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_mapping_free (PopplerLinkMapping *mapping) { poppler_action_free (mapping->action); g_free (mapping); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
614
poppler_page_copy_to_pixbuf(PopplerPage *page, GdkPixbuf *pixbuf, OutputDevData *data) { SplashOutputDev *output_dev; SplashBitmap *bitmap; SplashColorPtr color_ptr; int splash_width, splash_height, splash_rowstride; int pixbuf_rowstride, pixbuf_n_channels; guchar *pixbuf_data, *dst; int x, y; output_dev = page->document->output_dev; bitmap = output_dev->getBitmap (); color_ptr = bitmap->getDataPtr (); splash_width = bitmap->getWidth (); splash_height = bitmap->getHeight (); splash_rowstride = bitmap->getRowSize (); pixbuf_data = gdk_pixbuf_get_pixels (pixbuf); pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf); pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf); if (splash_width > gdk_pixbuf_get_width (pixbuf)) splash_width = gdk_pixbuf_get_width (pixbuf); if (splash_height > gdk_pixbuf_get_height (pixbuf)) splash_height = gdk_pixbuf_get_height (pixbuf); SplashColorPtr pixel = new Guchar[4]; for (y = 0; y < splash_height; y++) { dst = pixbuf_data + y * pixbuf_rowstride; for (x = 0; x < splash_width; x++) { output_dev->getBitmap()->getPixel(x, y, pixel); dst[0] = pixel[0]; dst[1] = pixel[1]; dst[2] = pixel[2]; if (pixbuf_n_channels == 4) dst[3] = 0xff; dst += pixbuf_n_channels; } } delete [] pixel; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_copy_to_pixbuf(PopplerPage *page, GdkPixbuf *pixbuf, OutputDevData *data) { SplashOutputDev *output_dev; SplashBitmap *bitmap; SplashColorPtr color_ptr; int splash_width, splash_height, splash_rowstride; int pixbuf_rowstride, pixbuf_n_channels; guchar *pixbuf_data, *dst; int x, y; output_dev = page->document->output_dev; bitmap = output_dev->getBitmap (); color_ptr = bitmap->getDataPtr (); splash_width = bitmap->getWidth (); splash_height = bitmap->getHeight (); splash_rowstride = bitmap->getRowSize (); pixbuf_data = gdk_pixbuf_get_pixels (pixbuf); pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf); pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf); if (splash_width > gdk_pixbuf_get_width (pixbuf)) splash_width = gdk_pixbuf_get_width (pixbuf); if (splash_height > gdk_pixbuf_get_height (pixbuf)) splash_height = gdk_pixbuf_get_height (pixbuf); SplashColorPtr pixel = new Guchar[4]; for (y = 0; y < splash_height; y++) { dst = pixbuf_data + y * pixbuf_rowstride; for (x = 0; x < splash_width; x++) { output_dev->getBitmap()->getPixel(x, y, pixel); dst[0] = pixel[0]; dst[1] = pixel[1]; dst[2] = pixel[2]; if (pixbuf_n_channels == 4) dst[3] = 0xff; dst += pixbuf_n_channels; } } delete [] pixel; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
615
poppler_page_find_text (PopplerPage *page, const char *text) { PopplerRectangle *match; GList *matches; double xMin, yMin, xMax, yMax; gunichar *ucs4; glong ucs4_len; double height; #if defined (HAVE_CAIRO) TextPage *text_dev; #else TextOutputDev *text_dev; #endif g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE); g_return_val_if_fail (text != NULL, FALSE); #if defined (HAVE_CAIRO) text_dev = poppler_page_get_text_page (page); #else text_dev = new TextOutputDev (NULL, gTrue, gFalse, gFalse); page->page->display (text_dev, 72, 72, 0, gFalse, gTrue, gFalse, page->document->doc->getCatalog()); #endif ucs4 = g_utf8_to_ucs4_fast (text, -1, &ucs4_len); poppler_page_get_size (page, NULL, &height); matches = NULL; xMin = 0; yMin = 0; while (text_dev->findText (ucs4, ucs4_len, gFalse, gTrue, // startAtTop, stopAtBottom gTrue, gFalse, // startAtLast, stopAtLast gFalse, gFalse, // caseSensitive, backwards &xMin, &yMin, &xMax, &yMax)) { match = g_new (PopplerRectangle, 1); match->x1 = xMin; match->y1 = height - yMax; match->x2 = xMax; match->y2 = height - yMin; matches = g_list_prepend (matches, match); } #if !defined (HAVE_CAIRO) delete text_dev; #endif g_free (ucs4); return g_list_reverse (matches); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_find_text (PopplerPage *page, const char *text) { PopplerRectangle *match; GList *matches; double xMin, yMin, xMax, yMax; gunichar *ucs4; glong ucs4_len; double height; #if defined (HAVE_CAIRO) TextPage *text_dev; #else TextOutputDev *text_dev; #endif g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE); g_return_val_if_fail (text != NULL, FALSE); #if defined (HAVE_CAIRO) text_dev = poppler_page_get_text_page (page); #else text_dev = new TextOutputDev (NULL, gTrue, gFalse, gFalse); page->page->display (text_dev, 72, 72, 0, gFalse, gTrue, gFalse, page->document->doc->getCatalog()); #endif ucs4 = g_utf8_to_ucs4_fast (text, -1, &ucs4_len); poppler_page_get_size (page, NULL, &height); matches = NULL; xMin = 0; yMin = 0; while (text_dev->findText (ucs4, ucs4_len, gFalse, gTrue, // startAtTop, stopAtBottom gTrue, gFalse, // startAtLast, stopAtLast gFalse, gFalse, // caseSensitive, backwards &xMin, &yMin, &xMax, &yMax)) { match = g_new (PopplerRectangle, 1); match->x1 = xMin; match->y1 = height - yMax; match->x2 = xMax; match->y2 = height - yMin; matches = g_list_prepend (matches, match); } #if !defined (HAVE_CAIRO) delete text_dev; #endif g_free (ucs4); return g_list_reverse (matches); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
616
poppler_page_free_annot_mapping (GList *list) { if (!list) return; g_list_foreach (list, (GFunc)poppler_annot_mapping_free, NULL); g_list_free (list); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_free_annot_mapping (GList *list) { if (!list) return; g_list_foreach (list, (GFunc)poppler_annot_mapping_free, NULL); g_list_free (list); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
617
poppler_page_free_form_field_mapping (GList *list) { if (list == NULL) return; g_list_foreach (list, (GFunc) poppler_form_field_mapping_free, NULL); g_list_free (list); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_free_form_field_mapping (GList *list) { if (list == NULL) return; g_list_foreach (list, (GFunc) poppler_form_field_mapping_free, NULL); g_list_free (list); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
618
poppler_page_free_image_mapping (GList *list) { if (list == NULL) return; g_list_foreach (list, (GFunc)g_free, NULL); g_list_free (list); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_free_image_mapping (GList *list) { if (list == NULL) return; g_list_foreach (list, (GFunc)g_free, NULL); g_list_free (list); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
619
poppler_page_free_image_mapping (GList *list) { }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_free_image_mapping (GList *list) { }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
620
poppler_page_free_link_mapping (GList *list) { if (list == NULL) return; g_list_foreach (list, (GFunc) (poppler_mapping_free), NULL); g_list_free (list); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_free_link_mapping (GList *list) { if (list == NULL) return; g_list_foreach (list, (GFunc) (poppler_mapping_free), NULL); g_list_free (list); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
621
poppler_page_get_annot_mapping (PopplerPage *page) { GList *map_list = NULL; double width, height; gint i; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); if (!page->annots) page->annots = page->page->getAnnots (page->document->doc->getCatalog ()); if (!page->annots) return NULL; poppler_page_get_size (page, &width, &height); for (i = 0; i < page->annots->getNumAnnots (); i++) { PopplerAnnotMapping *mapping; PopplerRectangle rect; Annot *annot; PDFRectangle *annot_rect; gint rotation = 0; annot = page->annots->getAnnot (i); /* Create the mapping */ mapping = poppler_annot_mapping_new (); switch (annot->getType ()) { case Annot::typeText: mapping->annot = _poppler_annot_text_new (annot); break; case Annot::typeFreeText: mapping->annot = _poppler_annot_free_text_new (annot); break; default: mapping->annot = _poppler_annot_new (annot); break; } annot_rect = annot->getRect (); rect.x1 = annot_rect->x1; rect.y1 = annot_rect->y1; rect.x2 = annot_rect->x2; rect.y2 = annot_rect->y2; if (! (annot->getFlags () & Annot::flagNoRotate)) rotation = page->page->getRotate (); switch (rotation) { case 90: mapping->area.x1 = rect.y1; mapping->area.y1 = height - rect.x2; mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1); mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1); break; case 180: mapping->area.x1 = width - rect.x2; mapping->area.y1 = height - rect.y2; mapping->area.x2 = mapping->area.x1 + (rect.x2 - rect.x1); mapping->area.y2 = mapping->area.y1 + (rect.y2 - rect.y1); break; case 270: mapping->area.x1 = width - rect.y2; mapping->area.y1 = rect.x1; mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1); mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1); break; default: mapping->area.x1 = rect.x1; mapping->area.y1 = rect.y1; mapping->area.x2 = rect.x2; mapping->area.y2 = rect.y2; } mapping->area.x1 -= page->page->getCropBox()->x1; mapping->area.x2 -= page->page->getCropBox()->x1; mapping->area.y1 -= page->page->getCropBox()->y1; mapping->area.y2 -= page->page->getCropBox()->y1; map_list = g_list_prepend (map_list, mapping); } return g_list_reverse (map_list); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_annot_mapping (PopplerPage *page) { GList *map_list = NULL; double width, height; gint i; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); if (!page->annots) page->annots = page->page->getAnnots (page->document->doc->getCatalog ()); if (!page->annots) return NULL; poppler_page_get_size (page, &width, &height); for (i = 0; i < page->annots->getNumAnnots (); i++) { PopplerAnnotMapping *mapping; PopplerRectangle rect; Annot *annot; PDFRectangle *annot_rect; gint rotation = 0; annot = page->annots->getAnnot (i); /* Create the mapping */ mapping = poppler_annot_mapping_new (); switch (annot->getType ()) { case Annot::typeText: mapping->annot = _poppler_annot_text_new (annot); break; case Annot::typeFreeText: mapping->annot = _poppler_annot_free_text_new (annot); break; default: mapping->annot = _poppler_annot_new (annot); break; } annot_rect = annot->getRect (); rect.x1 = annot_rect->x1; rect.y1 = annot_rect->y1; rect.x2 = annot_rect->x2; rect.y2 = annot_rect->y2; if (! (annot->getFlags () & Annot::flagNoRotate)) rotation = page->page->getRotate (); switch (rotation) { case 90: mapping->area.x1 = rect.y1; mapping->area.y1 = height - rect.x2; mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1); mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1); break; case 180: mapping->area.x1 = width - rect.x2; mapping->area.y1 = height - rect.y2; mapping->area.x2 = mapping->area.x1 + (rect.x2 - rect.x1); mapping->area.y2 = mapping->area.y1 + (rect.y2 - rect.y1); break; case 270: mapping->area.x1 = width - rect.y2; mapping->area.y1 = rect.x1; mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1); mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1); break; default: mapping->area.x1 = rect.x1; mapping->area.y1 = rect.y1; mapping->area.x2 = rect.x2; mapping->area.y2 = rect.y2; } mapping->area.x1 -= page->page->getCropBox()->x1; mapping->area.x2 -= page->page->getCropBox()->x1; mapping->area.y1 -= page->page->getCropBox()->y1; mapping->area.y2 -= page->page->getCropBox()->y1; map_list = g_list_prepend (map_list, mapping); } return g_list_reverse (map_list); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
622
poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect) { PDFRectangle* cropBox = page->page->getCropBox (); rect->x1 = cropBox->x1; rect->x2 = cropBox->x2; rect->y1 = cropBox->y1; rect->y2 = cropBox->y2; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect) { PDFRectangle* cropBox = page->page->getCropBox (); rect->x1 = cropBox->x1; rect->x2 = cropBox->x2; rect->y1 = cropBox->y1; rect->y2 = cropBox->y2; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
623
poppler_page_get_duration (PopplerPage *page) { g_return_val_if_fail (POPPLER_IS_PAGE (page), -1); return page->page->getDuration (); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_duration (PopplerPage *page) { g_return_val_if_fail (POPPLER_IS_PAGE (page), -1); return page->page->getDuration (); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
624
poppler_page_get_form_field_mapping (PopplerPage *page) { GList *map_list = NULL; FormPageWidgets *forms; gint i; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); forms = page->page->getPageWidgets (); if (forms == NULL) return NULL; for (i = 0; i < forms->getNumWidgets (); i++) { PopplerFormFieldMapping *mapping; FormWidget *field; mapping = poppler_form_field_mapping_new (); field = forms->getWidget (i); mapping->field = _poppler_form_field_new (page->document, field); field->getRect (&(mapping->area.x1), &(mapping->area.y1), &(mapping->area.x2), &(mapping->area.y2)); mapping->area.x1 -= page->page->getCropBox()->x1; mapping->area.x2 -= page->page->getCropBox()->x1; mapping->area.y1 -= page->page->getCropBox()->y1; mapping->area.y2 -= page->page->getCropBox()->y1; map_list = g_list_prepend (map_list, mapping); } return map_list; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_form_field_mapping (PopplerPage *page) { GList *map_list = NULL; FormPageWidgets *forms; gint i; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); forms = page->page->getPageWidgets (); if (forms == NULL) return NULL; for (i = 0; i < forms->getNumWidgets (); i++) { PopplerFormFieldMapping *mapping; FormWidget *field; mapping = poppler_form_field_mapping_new (); field = forms->getWidget (i); mapping->field = _poppler_form_field_new (page->document, field); field->getRect (&(mapping->area.x1), &(mapping->area.y1), &(mapping->area.x2), &(mapping->area.y2)); mapping->area.x1 -= page->page->getCropBox()->x1; mapping->area.x2 -= page->page->getCropBox()->x1; mapping->area.y1 -= page->page->getCropBox()->y1; mapping->area.y2 -= page->page->getCropBox()->y1; map_list = g_list_prepend (map_list, mapping); } return map_list; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
625
poppler_page_get_image_mapping (PopplerPage *page) { return NULL; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_image_mapping (PopplerPage *page) { return NULL; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
626
poppler_page_get_image_output_dev (PopplerPage *page, GBool (*imgDrawDeviceCbk)(int img_id, void *data), void *imgDrawCbkData) { CairoImageOutputDev *image_dev; Gfx *gfx; image_dev = new CairoImageOutputDev (); if (imgDrawDeviceCbk) { image_dev->setImageDrawDecideCbk (imgDrawDeviceCbk, imgDrawCbkData); } gfx = page->page->createGfx(image_dev, 72.0, 72.0, 0, gFalse, /* useMediaBox */ gTrue, /* Crop */ -1, -1, -1, -1, gFalse, /* printing */ page->document->doc->getCatalog (), NULL, NULL, NULL, NULL); page->page->display(gfx); delete gfx; return image_dev; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_image_output_dev (PopplerPage *page, GBool (*imgDrawDeviceCbk)(int img_id, void *data), void *imgDrawCbkData) { CairoImageOutputDev *image_dev; Gfx *gfx; image_dev = new CairoImageOutputDev (); if (imgDrawDeviceCbk) { image_dev->setImageDrawDecideCbk (imgDrawDeviceCbk, imgDrawCbkData); } gfx = page->page->createGfx(image_dev, 72.0, 72.0, 0, gFalse, /* useMediaBox */ gTrue, /* Crop */ -1, -1, -1, -1, gFalse, /* printing */ page->document->doc->getCatalog (), NULL, NULL, NULL, NULL); page->page->display(gfx); delete gfx; return image_dev; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
627
poppler_page_get_index (PopplerPage *page) { g_return_val_if_fail (POPPLER_IS_PAGE (page), 0); return page->index; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_index (PopplerPage *page) { g_return_val_if_fail (POPPLER_IS_PAGE (page), 0); return page->index; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
628
poppler_page_get_link_mapping (PopplerPage *page) { GList *map_list = NULL; gint i; Links *links; Object obj; double width, height; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); links = new Links (page->page->getAnnots (&obj), page->document->doc->getCatalog ()->getBaseURI ()); obj.free (); if (links == NULL) return NULL; poppler_page_get_size (page, &width, &height); for (i = 0; i < links->getNumLinks (); i++) { PopplerLinkMapping *mapping; PopplerRectangle rect; LinkAction *link_action; Link *link; link = links->getLink (i); link_action = link->getAction (); /* Create the mapping */ mapping = g_new (PopplerLinkMapping, 1); mapping->action = _poppler_action_new (page->document, link_action, NULL); link->getRect (&rect.x1, &rect.y1, &rect.x2, &rect.y2); switch (page->page->getRotate ()) { case 90: mapping->area.x1 = rect.y1; mapping->area.y1 = height - rect.x2; mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1); mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1); break; case 180: mapping->area.x1 = width - rect.x2; mapping->area.y1 = height - rect.y2; mapping->area.x2 = mapping->area.x1 + (rect.x2 - rect.x1); mapping->area.y2 = mapping->area.y1 + (rect.y2 - rect.y1); break; case 270: mapping->area.x1 = width - rect.y2; mapping->area.y1 = rect.x1; mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1); mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1); break; default: mapping->area.x1 = rect.x1; mapping->area.y1 = rect.y1; mapping->area.x2 = rect.x2; mapping->area.y2 = rect.y2; } mapping->area.x1 -= page->page->getCropBox()->x1; mapping->area.x2 -= page->page->getCropBox()->x1; mapping->area.y1 -= page->page->getCropBox()->y1; mapping->area.y2 -= page->page->getCropBox()->y1; map_list = g_list_prepend (map_list, mapping); } delete links; return map_list; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_link_mapping (PopplerPage *page) { GList *map_list = NULL; gint i; Links *links; Object obj; double width, height; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); links = new Links (page->page->getAnnots (&obj), page->document->doc->getCatalog ()->getBaseURI ()); obj.free (); if (links == NULL) return NULL; poppler_page_get_size (page, &width, &height); for (i = 0; i < links->getNumLinks (); i++) { PopplerLinkMapping *mapping; PopplerRectangle rect; LinkAction *link_action; Link *link; link = links->getLink (i); link_action = link->getAction (); /* Create the mapping */ mapping = g_new (PopplerLinkMapping, 1); mapping->action = _poppler_action_new (page->document, link_action, NULL); link->getRect (&rect.x1, &rect.y1, &rect.x2, &rect.y2); switch (page->page->getRotate ()) { case 90: mapping->area.x1 = rect.y1; mapping->area.y1 = height - rect.x2; mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1); mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1); break; case 180: mapping->area.x1 = width - rect.x2; mapping->area.y1 = height - rect.y2; mapping->area.x2 = mapping->area.x1 + (rect.x2 - rect.x1); mapping->area.y2 = mapping->area.y1 + (rect.y2 - rect.y1); break; case 270: mapping->area.x1 = width - rect.y2; mapping->area.y1 = rect.x1; mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1); mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1); break; default: mapping->area.x1 = rect.x1; mapping->area.y1 = rect.y1; mapping->area.x2 = rect.x2; mapping->area.y2 = rect.y2; } mapping->area.x1 -= page->page->getCropBox()->x1; mapping->area.x2 -= page->page->getCropBox()->x1; mapping->area.y1 -= page->page->getCropBox()->y1; mapping->area.y2 -= page->page->getCropBox()->y1; map_list = g_list_prepend (map_list, mapping); } delete links; return map_list; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
629
poppler_page_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { PopplerPage *page = POPPLER_PAGE (object); GooString label; switch (prop_id) { case PROP_LABEL: page->document->doc->getCatalog ()->indexToLabel (page->index, &label); g_value_take_string (value, _poppler_goo_string_to_utf8(&label)); break; } }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { PopplerPage *page = POPPLER_PAGE (object); GooString label; switch (prop_id) { case PROP_LABEL: page->document->doc->getCatalog ()->indexToLabel (page->index, &label); g_value_take_string (value, _poppler_goo_string_to_utf8(&label)); break; } }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
630
poppler_page_get_size (PopplerPage *page, double *width, double *height) { double page_width, page_height; int rotate; g_return_if_fail (POPPLER_IS_PAGE (page)); rotate = page->page->getRotate (); if (rotate == 90 || rotate == 270) { page_height = page->page->getCropWidth (); page_width = page->page->getCropHeight (); } else { page_width = page->page->getCropWidth (); page_height = page->page->getCropHeight (); } if (width != NULL) *width = page_width; if (height != NULL) *height = page_height; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_size (PopplerPage *page, double *width, double *height) { double page_width, page_height; int rotate; g_return_if_fail (POPPLER_IS_PAGE (page)); rotate = page->page->getRotate (); if (rotate == 90 || rotate == 270) { page_height = page->page->getCropWidth (); page_width = page->page->getCropHeight (); } else { page_width = page->page->getCropWidth (); page_height = page->page->getCropHeight (); } if (width != NULL) *width = page_width; if (height != NULL) *height = page_height; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
631
poppler_page_get_text_page (PopplerPage *page) { if (page->text == NULL) { cairo_t *cr; cairo_surface_t *surface; surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1); cr = cairo_create (surface); poppler_page_render (page, cr); cairo_destroy (cr); cairo_surface_destroy (surface); } return page->text; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_text_page (PopplerPage *page) { if (page->text == NULL) { cairo_t *cr; cairo_surface_t *surface; surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1); cr = cairo_create (surface); poppler_page_render (page, cr); cairo_destroy (cr); cairo_surface_destroy (surface); } return page->text; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
632
poppler_page_get_thumbnail_pixbuf (PopplerPage *page) { unsigned char *data; int width, height, rowstride; g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE); if (!page->page->loadThumb (&data, &width, &height, &rowstride)) return NULL; return gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, FALSE, 8, width, height, rowstride, (GdkPixbufDestroyNotify)gfree, NULL); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_thumbnail_pixbuf (PopplerPage *page) { unsigned char *data; int width, height, rowstride; g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE); if (!page->page->loadThumb (&data, &width, &height, &rowstride)) return NULL; return gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, FALSE, 8, width, height, rowstride, (GdkPixbufDestroyNotify)gfree, NULL); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
633
poppler_page_get_thumbnail_size (PopplerPage *page, int *width, int *height) { Object thumb; Dict *dict; gboolean retval = FALSE; g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE); g_return_val_if_fail (width != NULL, FALSE); g_return_val_if_fail (height != NULL, FALSE); page->page->getThumb (&thumb); if (!thumb.isStream ()) { thumb.free (); return FALSE; } dict = thumb.streamGetDict(); /* Theoretically, this could succeed and you would still fail when * loading the thumb */ if (dict->lookupInt ("Width", "W", width) && dict->lookupInt ("Height", "H", height)) retval = TRUE; thumb.free (); return retval; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_thumbnail_size (PopplerPage *page, int *width, int *height) { Object thumb; Dict *dict; gboolean retval = FALSE; g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE); g_return_val_if_fail (width != NULL, FALSE); g_return_val_if_fail (height != NULL, FALSE); page->page->getThumb (&thumb); if (!thumb.isStream ()) { thumb.free (); return FALSE; } dict = thumb.streamGetDict(); /* Theoretically, this could succeed and you would still fail when * loading the thumb */ if (dict->lookupInt ("Width", "W", width) && dict->lookupInt ("Height", "H", height)) retval = TRUE; thumb.free (); return retval; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
634
poppler_page_get_transition (PopplerPage *page) { PageTransition *trans; PopplerPageTransition *transition; Object obj; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); trans = new PageTransition (page->page->getTrans (&obj)); obj.free (); if (!trans->isOk ()) { delete trans; return NULL; } transition = poppler_page_transition_new (); switch (trans->getType ()) { case transitionReplace: transition->type = POPPLER_PAGE_TRANSITION_REPLACE; break; case transitionSplit: transition->type = POPPLER_PAGE_TRANSITION_SPLIT; break; case transitionBlinds: transition->type = POPPLER_PAGE_TRANSITION_BLINDS; break; case transitionBox: transition->type = POPPLER_PAGE_TRANSITION_BOX; break; case transitionWipe: transition->type = POPPLER_PAGE_TRANSITION_WIPE; break; case transitionDissolve: transition->type = POPPLER_PAGE_TRANSITION_DISSOLVE; break; case transitionGlitter: transition->type = POPPLER_PAGE_TRANSITION_GLITTER; break; case transitionFly: transition->type = POPPLER_PAGE_TRANSITION_FLY; break; case transitionPush: transition->type = POPPLER_PAGE_TRANSITION_PUSH; break; case transitionCover: transition->type = POPPLER_PAGE_TRANSITION_COVER; break; case transitionUncover: transition->type = POPPLER_PAGE_TRANSITION_UNCOVER; break; case transitionFade: transition->type = POPPLER_PAGE_TRANSITION_FADE; break; default: g_assert_not_reached (); } transition->alignment = (trans->getAlignment() == transitionHorizontal) ? POPPLER_PAGE_TRANSITION_HORIZONTAL : POPPLER_PAGE_TRANSITION_VERTICAL; transition->direction = (trans->getDirection() == transitionInward) ? POPPLER_PAGE_TRANSITION_INWARD : POPPLER_PAGE_TRANSITION_OUTWARD; transition->duration = trans->getDuration(); transition->angle = trans->getAngle(); transition->scale = trans->getScale(); transition->rectangular = trans->isRectangular(); delete trans; return transition; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_get_transition (PopplerPage *page) { PageTransition *trans; PopplerPageTransition *transition; Object obj; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); trans = new PageTransition (page->page->getTrans (&obj)); obj.free (); if (!trans->isOk ()) { delete trans; return NULL; } transition = poppler_page_transition_new (); switch (trans->getType ()) { case transitionReplace: transition->type = POPPLER_PAGE_TRANSITION_REPLACE; break; case transitionSplit: transition->type = POPPLER_PAGE_TRANSITION_SPLIT; break; case transitionBlinds: transition->type = POPPLER_PAGE_TRANSITION_BLINDS; break; case transitionBox: transition->type = POPPLER_PAGE_TRANSITION_BOX; break; case transitionWipe: transition->type = POPPLER_PAGE_TRANSITION_WIPE; break; case transitionDissolve: transition->type = POPPLER_PAGE_TRANSITION_DISSOLVE; break; case transitionGlitter: transition->type = POPPLER_PAGE_TRANSITION_GLITTER; break; case transitionFly: transition->type = POPPLER_PAGE_TRANSITION_FLY; break; case transitionPush: transition->type = POPPLER_PAGE_TRANSITION_PUSH; break; case transitionCover: transition->type = POPPLER_PAGE_TRANSITION_COVER; break; case transitionUncover: transition->type = POPPLER_PAGE_TRANSITION_UNCOVER; break; case transitionFade: transition->type = POPPLER_PAGE_TRANSITION_FADE; break; default: g_assert_not_reached (); } transition->alignment = (trans->getAlignment() == transitionHorizontal) ? POPPLER_PAGE_TRANSITION_HORIZONTAL : POPPLER_PAGE_TRANSITION_VERTICAL; transition->direction = (trans->getDirection() == transitionInward) ? POPPLER_PAGE_TRANSITION_INWARD : POPPLER_PAGE_TRANSITION_OUTWARD; transition->duration = trans->getDuration(); transition->angle = trans->getAngle(); transition->scale = trans->getScale(); transition->rectangular = trans->isRectangular(); delete trans; return transition; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
635
poppler_page_init (PopplerPage *page) { }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_init (PopplerPage *page) { }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
636
poppler_page_prepare_output_dev (PopplerPage *page, double scale, int rotation, gboolean transparent, OutputDevData *output_dev_data) { CairoOutputDev *output_dev; cairo_surface_t *surface; double width, height; int cairo_width, cairo_height, cairo_rowstride, rotate; unsigned char *cairo_data; rotate = rotation + page->page->getRotate (); if (rotate == 90 || rotate == 270) { height = page->page->getCropWidth (); width = page->page->getCropHeight (); } else { width = page->page->getCropWidth (); height = page->page->getCropHeight (); } cairo_width = (int) ceil(width * scale); cairo_height = (int) ceil(height * scale); output_dev = page->document->output_dev; cairo_rowstride = cairo_width * 4; cairo_data = (guchar *) gmallocn (cairo_height, cairo_rowstride); if (transparent) memset (cairo_data, 0x00, cairo_height * cairo_rowstride); else memset (cairo_data, 0xff, cairo_height * cairo_rowstride); surface = cairo_image_surface_create_for_data(cairo_data, CAIRO_FORMAT_ARGB32, cairo_width, cairo_height, cairo_rowstride); output_dev_data->cairo_data = cairo_data; output_dev_data->surface = surface; output_dev_data->cairo = cairo_create (surface); output_dev->setCairo (output_dev_data->cairo); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_prepare_output_dev (PopplerPage *page, double scale, int rotation, gboolean transparent, OutputDevData *output_dev_data) { CairoOutputDev *output_dev; cairo_surface_t *surface; double width, height; int cairo_width, cairo_height, cairo_rowstride, rotate; unsigned char *cairo_data; rotate = rotation + page->page->getRotate (); if (rotate == 90 || rotate == 270) { height = page->page->getCropWidth (); width = page->page->getCropHeight (); } else { width = page->page->getCropWidth (); height = page->page->getCropHeight (); } cairo_width = (int) ceil(width * scale); cairo_height = (int) ceil(height * scale); output_dev = page->document->output_dev; cairo_rowstride = cairo_width * 4; cairo_data = (guchar *) gmallocn (cairo_height, cairo_rowstride); if (transparent) memset (cairo_data, 0x00, cairo_height * cairo_rowstride); else memset (cairo_data, 0xff, cairo_height * cairo_rowstride); surface = cairo_image_surface_create_for_data(cairo_data, CAIRO_FORMAT_ARGB32, cairo_width, cairo_height, cairo_rowstride); output_dev_data->cairo_data = cairo_data; output_dev_data->surface = surface; output_dev_data->cairo = cairo_create (surface); output_dev->setCairo (output_dev_data->cairo); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
637
poppler_page_prepare_output_dev (PopplerPage *page, double scale, int rotation, gboolean transparent, OutputDevData *output_dev_data) { /* pft */ }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_prepare_output_dev (PopplerPage *page, double scale, int rotation, gboolean transparent, OutputDevData *output_dev_data) { /* pft */ }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
638
poppler_page_render_selection_to_pixbuf (PopplerPage *page, gdouble scale, int rotation, GdkPixbuf *pixbuf, PopplerRectangle *selection, PopplerRectangle *old_selection, PopplerSelectionStyle style, GdkColor *glyph_color, GdkColor *background_color) { OutputDev *output_dev; OutputDevData data; SelectionStyle selection_style = selectionStyleGlyph; PDFRectangle pdf_selection(selection->x1, selection->y1, selection->x2, selection->y2); GfxColor gfx_background_color = { { background_color->red, background_color->green, background_color->blue } }; GfxColor gfx_glyph_color = { { glyph_color->red, glyph_color->green, glyph_color->blue } }; switch (style) { case POPPLER_SELECTION_GLYPH: selection_style = selectionStyleGlyph; break; case POPPLER_SELECTION_WORD: selection_style = selectionStyleWord; break; case POPPLER_SELECTION_LINE: selection_style = selectionStyleLine; break; } output_dev = page->document->output_dev; poppler_page_prepare_output_dev (page, scale, rotation, TRUE, &data); #if defined (HAVE_CAIRO) TextPage *text; text = poppler_page_get_text_page (page); text->drawSelection (output_dev, scale, rotation, &pdf_selection, selection_style, &gfx_glyph_color, &gfx_background_color); #else TextOutputDev *text_dev; text_dev = poppler_page_get_text_output_dev (page); text_dev->drawSelection (output_dev, scale, rotation, &pdf_selection, selection_style, &gfx_glyph_color, &gfx_background_color); /* We'll need a function to destroy page->text_dev and page->gfx * when the application wants to get rid of them. * * Two improvements: 1) make GfxFont refcounted and let TextPage and * friends hold a reference to the GfxFonts they need so we can free * up Gfx early. 2) use a TextPage directly when rendering the page * so we don't have to use TextOutputDev and render a second * time. */ #endif poppler_page_copy_to_pixbuf (page, pixbuf, &data); poppler_page_set_selection_alpha (page, scale, pixbuf, style, selection); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_render_selection_to_pixbuf (PopplerPage *page, gdouble scale, int rotation, GdkPixbuf *pixbuf, PopplerRectangle *selection, PopplerRectangle *old_selection, PopplerSelectionStyle style, GdkColor *glyph_color, GdkColor *background_color) { OutputDev *output_dev; OutputDevData data; SelectionStyle selection_style = selectionStyleGlyph; PDFRectangle pdf_selection(selection->x1, selection->y1, selection->x2, selection->y2); GfxColor gfx_background_color = { { background_color->red, background_color->green, background_color->blue } }; GfxColor gfx_glyph_color = { { glyph_color->red, glyph_color->green, glyph_color->blue } }; switch (style) { case POPPLER_SELECTION_GLYPH: selection_style = selectionStyleGlyph; break; case POPPLER_SELECTION_WORD: selection_style = selectionStyleWord; break; case POPPLER_SELECTION_LINE: selection_style = selectionStyleLine; break; } output_dev = page->document->output_dev; poppler_page_prepare_output_dev (page, scale, rotation, TRUE, &data); #if defined (HAVE_CAIRO) TextPage *text; text = poppler_page_get_text_page (page); text->drawSelection (output_dev, scale, rotation, &pdf_selection, selection_style, &gfx_glyph_color, &gfx_background_color); #else TextOutputDev *text_dev; text_dev = poppler_page_get_text_output_dev (page); text_dev->drawSelection (output_dev, scale, rotation, &pdf_selection, selection_style, &gfx_glyph_color, &gfx_background_color); /* We'll need a function to destroy page->text_dev and page->gfx * when the application wants to get rid of them. * * Two improvements: 1) make GfxFont refcounted and let TextPage and * friends hold a reference to the GfxFonts they need so we can free * up Gfx early. 2) use a TextPage directly when rendering the page * so we don't have to use TextOutputDev and render a second * time. */ #endif poppler_page_copy_to_pixbuf (page, pixbuf, &data); poppler_page_set_selection_alpha (page, scale, pixbuf, style, selection); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
639
poppler_page_render_to_pixbuf (PopplerPage *page, int src_x, int src_y, int src_width, int src_height, double scale, int rotation, GdkPixbuf *pixbuf) { g_return_if_fail (POPPLER_IS_PAGE (page)); g_return_if_fail (scale > 0.0); g_return_if_fail (pixbuf != NULL); _poppler_page_render_to_pixbuf (page, src_x, src_y, src_width, src_height, scale, rotation, gFalse, pixbuf); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_render_to_pixbuf (PopplerPage *page, int src_x, int src_y, int src_width, int src_height, double scale, int rotation, GdkPixbuf *pixbuf) { g_return_if_fail (POPPLER_IS_PAGE (page)); g_return_if_fail (scale > 0.0); g_return_if_fail (pixbuf != NULL); _poppler_page_render_to_pixbuf (page, src_x, src_y, src_width, src_height, scale, rotation, gFalse, pixbuf); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
640
poppler_page_render_to_pixbuf_for_printing (PopplerPage *page, int src_x, int src_y, int src_width, int src_height, double scale, int rotation, GdkPixbuf *pixbuf) { g_return_if_fail (POPPLER_IS_PAGE (page)); g_return_if_fail (scale > 0.0); g_return_if_fail (pixbuf != NULL); _poppler_page_render_to_pixbuf (page, src_x, src_y, src_width, src_height, scale, rotation, gTrue, pixbuf); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_render_to_pixbuf_for_printing (PopplerPage *page, int src_x, int src_y, int src_width, int src_height, double scale, int rotation, GdkPixbuf *pixbuf) { g_return_if_fail (POPPLER_IS_PAGE (page)); g_return_if_fail (scale > 0.0); g_return_if_fail (pixbuf != NULL); _poppler_page_render_to_pixbuf (page, src_x, src_y, src_width, src_height, scale, rotation, gTrue, pixbuf); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
641
poppler_page_render_to_ps (PopplerPage *page, PopplerPSFile *ps_file) { g_return_if_fail (POPPLER_IS_PAGE (page)); g_return_if_fail (ps_file != NULL); if (!ps_file->out) ps_file->out = new PSOutputDev (ps_file->filename, ps_file->document->doc->getXRef(), ps_file->document->doc->getCatalog(), NULL, ps_file->first_page, ps_file->last_page, psModePS, (int)ps_file->paper_width, (int)ps_file->paper_height, ps_file->duplex, 0, 0, 0, 0, gFalse, gFalse); ps_file->document->doc->displayPage (ps_file->out, page->index + 1, 72.0, 72.0, 0, gFalse, gTrue, gFalse); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_render_to_ps (PopplerPage *page, PopplerPSFile *ps_file) { g_return_if_fail (POPPLER_IS_PAGE (page)); g_return_if_fail (ps_file != NULL); if (!ps_file->out) ps_file->out = new PSOutputDev (ps_file->filename, ps_file->document->doc->getXRef(), ps_file->document->doc->getCatalog(), NULL, ps_file->first_page, ps_file->last_page, psModePS, (int)ps_file->paper_width, (int)ps_file->paper_height, ps_file->duplex, 0, 0, 0, 0, gFalse, gFalse); ps_file->document->doc->displayPage (ps_file->out, page->index + 1, 72.0, 72.0, 0, gFalse, gTrue, gFalse); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
642
poppler_page_selection_region_free (GList *region) { if (!region) return; g_list_foreach (region, (GFunc)poppler_rectangle_free, NULL); g_list_free (region); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_selection_region_free (GList *region) { if (!region) return; g_list_foreach (region, (GFunc)poppler_rectangle_free, NULL); g_list_free (region); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
643
poppler_page_set_selection_alpha (PopplerPage *page, double scale, GdkPixbuf *pixbuf, PopplerSelectionStyle style, PopplerRectangle *selection) { /* Cairo doesn't need this, since cairo generates an alpha channel. */ }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_set_selection_alpha (PopplerPage *page, double scale, GdkPixbuf *pixbuf, PopplerSelectionStyle style, PopplerRectangle *selection) { /* Cairo doesn't need this, since cairo generates an alpha channel. */ }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
644
poppler_page_set_selection_alpha (PopplerPage *page, double scale, GdkPixbuf *pixbuf, PopplerSelectionStyle style, PopplerRectangle *selection) { GList *region, *l; gint x, y, width, height; int pixbuf_rowstride, pixbuf_n_channels; guchar *pixbuf_data, *dst; pixbuf_data = gdk_pixbuf_get_pixels (pixbuf); pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf); pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf); width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); if (pixbuf_n_channels != 4) return; for (y = 0; y < height; y++) { dst = pixbuf_data + y * pixbuf_rowstride; for (x = 0; x < width; x++) { dst[3] = 0x00; dst += pixbuf_n_channels; } } region = poppler_page_get_selection_region (page, scale, style, selection); for (l = region; l; l = g_list_next (l)) { PopplerRectangle *rectangle = (PopplerRectangle *)l->data; GdkRectangle rect; rect.x = (gint)rectangle->x1; rect.y = (gint)rectangle->y1; rect.width = (gint) (rectangle->x2 - rectangle->x1); rect.height = (gint) (rectangle->y2 - rectangle->y1); for (y = 0; y < rect.height; y++) { dst = pixbuf_data + (rect.y + y) * pixbuf_rowstride + rect.x * pixbuf_n_channels; for (x = 0; x < rect.width; x++) { dst[3] = 0xff; dst += pixbuf_n_channels; } } } poppler_page_selection_region_free (region); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_set_selection_alpha (PopplerPage *page, double scale, GdkPixbuf *pixbuf, PopplerSelectionStyle style, PopplerRectangle *selection) { GList *region, *l; gint x, y, width, height; int pixbuf_rowstride, pixbuf_n_channels; guchar *pixbuf_data, *dst; pixbuf_data = gdk_pixbuf_get_pixels (pixbuf); pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf); pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf); width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); if (pixbuf_n_channels != 4) return; for (y = 0; y < height; y++) { dst = pixbuf_data + y * pixbuf_rowstride; for (x = 0; x < width; x++) { dst[3] = 0x00; dst += pixbuf_n_channels; } } region = poppler_page_get_selection_region (page, scale, style, selection); for (l = region; l; l = g_list_next (l)) { PopplerRectangle *rectangle = (PopplerRectangle *)l->data; GdkRectangle rect; rect.x = (gint)rectangle->x1; rect.y = (gint)rectangle->y1; rect.width = (gint) (rectangle->x2 - rectangle->x1); rect.height = (gint) (rectangle->y2 - rectangle->y1); for (y = 0; y < rect.height; y++) { dst = pixbuf_data + (rect.y + y) * pixbuf_rowstride + rect.x * pixbuf_n_channels; for (x = 0; x < rect.width; x++) { dst[3] = 0xff; dst += pixbuf_n_channels; } } } poppler_page_selection_region_free (region); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
645
poppler_page_transition_copy (PopplerPageTransition *transition) { PopplerPageTransition *new_transition; new_transition = poppler_page_transition_new (); *new_transition = *transition; return new_transition; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_transition_copy (PopplerPageTransition *transition) { PopplerPageTransition *new_transition; new_transition = poppler_page_transition_new (); *new_transition = *transition; return new_transition; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
646
poppler_page_transition_free (PopplerPageTransition *transition) { g_free (transition); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_transition_free (PopplerPageTransition *transition) { g_free (transition); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
647
poppler_page_transition_new (void) { return (PopplerPageTransition *) g_new0 (PopplerPageTransition, 1); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_page_transition_new (void) { return (PopplerPageTransition *) g_new0 (PopplerPageTransition, 1); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
648
poppler_print_annot_cb (Annot *annot, void *user_data) { if (annot->getFlags () & Annot::flagPrint) return gTrue; return (annot->getType() == Annot::typeWidget); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_print_annot_cb (Annot *annot, void *user_data) { if (annot->getFlags () & Annot::flagPrint) return gTrue; return (annot->getType() == Annot::typeWidget); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
649
poppler_rectangle_copy (PopplerRectangle *rectangle) { PopplerRectangle *new_rectangle; g_return_val_if_fail (rectangle != NULL, NULL); new_rectangle = g_new (PopplerRectangle, 1); *new_rectangle = *rectangle; return new_rectangle; }
DoS Exec Code Overflow Mem. Corr.
0
poppler_rectangle_copy (PopplerRectangle *rectangle) { PopplerRectangle *new_rectangle; g_return_val_if_fail (rectangle != NULL, NULL); new_rectangle = g_new (PopplerRectangle, 1); *new_rectangle = *rectangle; return new_rectangle; }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
650
poppler_rectangle_free (PopplerRectangle *rectangle) { g_free (rectangle); }
DoS Exec Code Overflow Mem. Corr.
0
poppler_rectangle_free (PopplerRectangle *rectangle) { g_free (rectangle); }
@@ -609,28 +609,28 @@ create_surface_from_thumbnail_data (guchar *data, gint rowstride) { guchar *cairo_pixels; + gint cairo_stride; cairo_surface_t *surface; - static cairo_user_data_key_t key; int j; - cairo_pixels = (guchar *)g_malloc (4 * width * height); - surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels, - CAIRO_FORMAT_RGB24, - width, height, 4 * width); - cairo_surface_set_user_data (surface, &key, - cairo_pixels, (cairo_destroy_func_t)g_free); + surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (cairo_surface_status (surface)) + return NULL; + + cairo_pixels = cairo_image_surface_get_data (surface); + cairo_stride = cairo_image_surface_get_stride (surface); for (j = height; j; j--) { guchar *p = data; guchar *q = cairo_pixels; guchar *end = p + 3 * width; - + while (p < end) { #if G_BYTE_ORDER == G_LITTLE_ENDIAN q[0] = p[2]; q[1] = p[1]; q[2] = p[0]; -#else +#else q[1] = p[0]; q[2] = p[1]; q[3] = p[2]; @@ -640,7 +640,7 @@ create_surface_from_thumbnail_data (guchar *data, } data += rowstride; - cairo_pixels += 4 * width; + cairo_pixels += cairo_stride; } return surface;
CWE-189
null
null
651
SplashOutFontFileID(Ref *rA) { r = *rA; }
DoS Exec Code Overflow
0
SplashOutFontFileID(Ref *rA) { r = *rA; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
652
SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, GBool reverseVideoA, SplashColorPtr paperColorA, GBool bitmapTopDownA, GBool allowAntialiasA) { colorMode = colorModeA; bitmapRowPad = bitmapRowPadA; bitmapTopDown = bitmapTopDownA; allowAntialias = allowAntialiasA; vectorAntialias = allowAntialias && globalParams->getVectorAntialias() && colorMode != splashModeMono1; setupScreenParams(72.0, 72.0); reverseVideo = reverseVideoA; splashColorCopy(paperColor, paperColorA); xref = NULL; bitmap = new SplashBitmap(1, 1, bitmapRowPad, colorMode, colorMode != splashModeMono1, bitmapTopDown); splash = new Splash(bitmap, vectorAntialias, &screenParams); splash->clear(paperColor, 0); fontEngine = NULL; nT3Fonts = 0; t3GlyphStack = NULL; font = NULL; needFontUpdate = gFalse; textClipPath = NULL; transpGroupStack = NULL; }
DoS Exec Code Overflow
0
SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, GBool reverseVideoA, SplashColorPtr paperColorA, GBool bitmapTopDownA, GBool allowAntialiasA) { colorMode = colorModeA; bitmapRowPad = bitmapRowPadA; bitmapTopDown = bitmapTopDownA; allowAntialias = allowAntialiasA; vectorAntialias = allowAntialias && globalParams->getVectorAntialias() && colorMode != splashModeMono1; setupScreenParams(72.0, 72.0); reverseVideo = reverseVideoA; splashColorCopy(paperColor, paperColorA); xref = NULL; bitmap = new SplashBitmap(1, 1, bitmapRowPad, colorMode, colorMode != splashModeMono1, bitmapTopDown); splash = new Splash(bitmap, vectorAntialias, &screenParams); splash->clear(paperColor, 0); fontEngine = NULL; nT3Fonts = 0; t3GlyphStack = NULL; font = NULL; needFontUpdate = gFalse; textClipPath = NULL; transpGroupStack = NULL; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
653
T3FontCache::T3FontCache(Ref *fontIDA, double m11A, double m12A, double m21A, double m22A, int glyphXA, int glyphYA, int glyphWA, int glyphHA, GBool validBBoxA, GBool aa) { int i; fontID = *fontIDA; m11 = m11A; m12 = m12A; m21 = m21A; m22 = m22A; glyphX = glyphXA; glyphY = glyphYA; glyphW = glyphWA; glyphH = glyphHA; validBBox = validBBoxA; if (aa) { glyphSize = glyphW * glyphH; } else { glyphSize = ((glyphW + 7) >> 3) * glyphH; } cacheAssoc = 8; if (glyphSize <= 256) { cacheSets = 8; } else if (glyphSize <= 512) { cacheSets = 4; } else if (glyphSize <= 1024) { cacheSets = 2; } else if (glyphSize <= 2048) { cacheSets = 1; cacheAssoc = 4; } else if (glyphSize <= 4096) { cacheSets = 1; cacheAssoc = 2; } else { cacheSets = 1; cacheAssoc = 1; } if (glyphSize < 10485760 / cacheAssoc / cacheSets) { cacheData = (Guchar *)gmallocn_checkoverflow(cacheSets * cacheAssoc, glyphSize); } else { error(-1, "Not creating cacheData for T3FontCache, it asked for too much memory.\n" " This could teoretically result in wrong rendering,\n" " but most probably the document is bogus.\n" " Please report a bug if you think the rendering may be wrong because of this."); cacheData = NULL; } if (cacheData != NULL) { cacheTags = (T3FontCacheTag *)gmallocn(cacheSets * cacheAssoc, sizeof(T3FontCacheTag)); for (i = 0; i < cacheSets * cacheAssoc; ++i) { cacheTags[i].mru = i & (cacheAssoc - 1); } } else { cacheTags = NULL; } }
DoS Exec Code Overflow
0
T3FontCache::T3FontCache(Ref *fontIDA, double m11A, double m12A, double m21A, double m22A, int glyphXA, int glyphYA, int glyphWA, int glyphHA, GBool validBBoxA, GBool aa) { int i; fontID = *fontIDA; m11 = m11A; m12 = m12A; m21 = m21A; m22 = m22A; glyphX = glyphXA; glyphY = glyphYA; glyphW = glyphWA; glyphH = glyphHA; validBBox = validBBoxA; if (aa) { glyphSize = glyphW * glyphH; } else { glyphSize = ((glyphW + 7) >> 3) * glyphH; } cacheAssoc = 8; if (glyphSize <= 256) { cacheSets = 8; } else if (glyphSize <= 512) { cacheSets = 4; } else if (glyphSize <= 1024) { cacheSets = 2; } else if (glyphSize <= 2048) { cacheSets = 1; cacheAssoc = 4; } else if (glyphSize <= 4096) { cacheSets = 1; cacheAssoc = 2; } else { cacheSets = 1; cacheAssoc = 1; } if (glyphSize < 10485760 / cacheAssoc / cacheSets) { cacheData = (Guchar *)gmallocn_checkoverflow(cacheSets * cacheAssoc, glyphSize); } else { error(-1, "Not creating cacheData for T3FontCache, it asked for too much memory.\n" " This could teoretically result in wrong rendering,\n" " but most probably the document is bogus.\n" " Please report a bug if you think the rendering may be wrong because of this."); cacheData = NULL; } if (cacheData != NULL) { cacheTags = (T3FontCacheTag *)gmallocn(cacheSets * cacheAssoc, sizeof(T3FontCacheTag)); for (i = 0; i < cacheSets * cacheAssoc; ++i) { cacheTags[i].mru = i & (cacheAssoc - 1); } } else { cacheTags = NULL; } }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
654
GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, Guchar *alphaLine) { SplashOutImageData *imgData = (SplashOutImageData *)data; Guchar *p, *aq; SplashColorPtr q, col; GfxRGB rgb; GfxGray gray; #if SPLASH_CMYK GfxCMYK cmyk; #endif Guchar alpha; int nComps, x, i; if (imgData->y == imgData->height) { return gFalse; } nComps = imgData->colorMap->getNumPixelComps(); for (x = 0, p = imgData->imgStr->getLine(), q = colorLine, aq = alphaLine; x < imgData->width; ++x, p += nComps) { alpha = 0; for (i = 0; i < nComps; ++i) { if (p[i] < imgData->maskColors[2*i] || p[i] > imgData->maskColors[2*i+1]) { alpha = 0xff; break; } } if (imgData->lookup) { switch (imgData->colorMode) { case splashModeMono1: case splashModeMono8: *q++ = imgData->lookup[*p]; *aq++ = alpha; break; case splashModeRGB8: case splashModeBGR8: col = &imgData->lookup[3 * *p]; *q++ = col[0]; *q++ = col[1]; *q++ = col[2]; *aq++ = alpha; break; case splashModeXBGR8: col = &imgData->lookup[4 * *p]; *q++ = col[0]; *q++ = col[1]; *q++ = col[2]; *q++ = 255; *aq++ = alpha; break; #if SPLASH_CMYK case splashModeCMYK8: col = &imgData->lookup[4 * *p]; *q++ = col[0]; *q++ = col[1]; *q++ = col[2]; *q++ = col[3]; *aq++ = alpha; break; #endif } } else { switch (imgData->colorMode) { case splashModeMono1: case splashModeMono8: imgData->colorMap->getGray(p, &gray); *q++ = colToByte(gray); *aq++ = alpha; break; case splashModeXBGR8: case splashModeRGB8: case splashModeBGR8: imgData->colorMap->getRGB(p, &rgb); *q++ = colToByte(rgb.r); *q++ = colToByte(rgb.g); *q++ = colToByte(rgb.b); if (imgData->colorMode == splashModeXBGR8) *q++ = 255; *aq++ = alpha; break; #if SPLASH_CMYK case splashModeCMYK8: imgData->colorMap->getCMYK(p, &cmyk); *q++ = colToByte(cmyk.c); *q++ = colToByte(cmyk.m); *q++ = colToByte(cmyk.y); *q++ = colToByte(cmyk.k); *aq++ = alpha; break; #endif } } } ++imgData->y; return gTrue; }
DoS Exec Code Overflow
0
GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, Guchar *alphaLine) { SplashOutImageData *imgData = (SplashOutImageData *)data; Guchar *p, *aq; SplashColorPtr q, col; GfxRGB rgb; GfxGray gray; #if SPLASH_CMYK GfxCMYK cmyk; #endif Guchar alpha; int nComps, x, i; if (imgData->y == imgData->height) { return gFalse; } nComps = imgData->colorMap->getNumPixelComps(); for (x = 0, p = imgData->imgStr->getLine(), q = colorLine, aq = alphaLine; x < imgData->width; ++x, p += nComps) { alpha = 0; for (i = 0; i < nComps; ++i) { if (p[i] < imgData->maskColors[2*i] || p[i] > imgData->maskColors[2*i+1]) { alpha = 0xff; break; } } if (imgData->lookup) { switch (imgData->colorMode) { case splashModeMono1: case splashModeMono8: *q++ = imgData->lookup[*p]; *aq++ = alpha; break; case splashModeRGB8: case splashModeBGR8: col = &imgData->lookup[3 * *p]; *q++ = col[0]; *q++ = col[1]; *q++ = col[2]; *aq++ = alpha; break; case splashModeXBGR8: col = &imgData->lookup[4 * *p]; *q++ = col[0]; *q++ = col[1]; *q++ = col[2]; *q++ = 255; *aq++ = alpha; break; #if SPLASH_CMYK case splashModeCMYK8: col = &imgData->lookup[4 * *p]; *q++ = col[0]; *q++ = col[1]; *q++ = col[2]; *q++ = col[3]; *aq++ = alpha; break; #endif } } else { switch (imgData->colorMode) { case splashModeMono1: case splashModeMono8: imgData->colorMap->getGray(p, &gray); *q++ = colToByte(gray); *aq++ = alpha; break; case splashModeXBGR8: case splashModeRGB8: case splashModeBGR8: imgData->colorMap->getRGB(p, &rgb); *q++ = colToByte(rgb.r); *q++ = colToByte(rgb.g); *q++ = colToByte(rgb.b); if (imgData->colorMode == splashModeXBGR8) *q++ = 255; *aq++ = alpha; break; #if SPLASH_CMYK case splashModeCMYK8: imgData->colorMap->getCMYK(p, &cmyk); *q++ = colToByte(cmyk.c); *q++ = colToByte(cmyk.m); *q++ = colToByte(cmyk.y); *q++ = colToByte(cmyk.k); *aq++ = alpha; break; #endif } } } ++imgData->y; return gTrue; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
655
GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { GfxFont *gfxFont; Ref *fontID; double *ctm, *bbox; T3FontCache *t3Font; T3GlyphStack *t3gs; GBool validBBox; double x1, y1, xMin, yMin, xMax, yMax, xt, yt; int i, j; if (!(gfxFont = state->getFont())) { return gFalse; } fontID = gfxFont->getID(); ctm = state->getCTM(); state->transform(0, 0, &xt, &yt); if (!(nT3Fonts > 0 && t3FontCache[0]->matches(fontID, ctm[0], ctm[1], ctm[2], ctm[3]))) { for (i = 1; i < nT3Fonts; ++i) { if (t3FontCache[i]->matches(fontID, ctm[0], ctm[1], ctm[2], ctm[3])) { t3Font = t3FontCache[i]; for (j = i; j > 0; --j) { t3FontCache[j] = t3FontCache[j - 1]; } t3FontCache[0] = t3Font; break; } } if (i >= nT3Fonts) { if (nT3Fonts == splashOutT3FontCacheSize) { delete t3FontCache[nT3Fonts - 1]; --nT3Fonts; } for (j = nT3Fonts; j > 0; --j) { t3FontCache[j] = t3FontCache[j - 1]; } ++nT3Fonts; bbox = gfxFont->getFontBBox(); if (bbox[0] == 0 && bbox[1] == 0 && bbox[2] == 0 && bbox[3] == 0) { xMin = xt - 5; xMax = xMin + 30; yMax = yt + 15; yMin = yMax - 45; validBBox = gFalse; } else { state->transform(bbox[0], bbox[1], &x1, &y1); xMin = xMax = x1; yMin = yMax = y1; state->transform(bbox[0], bbox[3], &x1, &y1); if (x1 < xMin) { xMin = x1; } else if (x1 > xMax) { xMax = x1; } if (y1 < yMin) { yMin = y1; } else if (y1 > yMax) { yMax = y1; } state->transform(bbox[2], bbox[1], &x1, &y1); if (x1 < xMin) { xMin = x1; } else if (x1 > xMax) { xMax = x1; } if (y1 < yMin) { yMin = y1; } else if (y1 > yMax) { yMax = y1; } state->transform(bbox[2], bbox[3], &x1, &y1); if (x1 < xMin) { xMin = x1; } else if (x1 > xMax) { xMax = x1; } if (y1 < yMin) { yMin = y1; } else if (y1 > yMax) { yMax = y1; } validBBox = gTrue; } t3FontCache[0] = new T3FontCache(fontID, ctm[0], ctm[1], ctm[2], ctm[3], (int)floor(xMin - xt), (int)floor(yMin - yt), (int)ceil(xMax) - (int)floor(xMin) + 3, (int)ceil(yMax) - (int)floor(yMin) + 3, validBBox, colorMode != splashModeMono1); } } t3Font = t3FontCache[0]; i = (code & (t3Font->cacheSets - 1)) * t3Font->cacheAssoc; for (j = 0; j < t3Font->cacheAssoc; ++j) { if (t3Font->cacheTags != NULL) { if ((t3Font->cacheTags[i+j].mru & 0x8000) && t3Font->cacheTags[i+j].code == code) { drawType3Glyph(t3Font, &t3Font->cacheTags[i+j], t3Font->cacheData + (i+j) * t3Font->glyphSize); return gTrue; } } } t3gs = new T3GlyphStack(); t3gs->next = t3GlyphStack; t3GlyphStack = t3gs; t3GlyphStack->code = code; t3GlyphStack->cache = t3Font; t3GlyphStack->cacheTag = NULL; t3GlyphStack->cacheData = NULL; return gFalse; }
DoS Exec Code Overflow
0
GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { GfxFont *gfxFont; Ref *fontID; double *ctm, *bbox; T3FontCache *t3Font; T3GlyphStack *t3gs; GBool validBBox; double x1, y1, xMin, yMin, xMax, yMax, xt, yt; int i, j; if (!(gfxFont = state->getFont())) { return gFalse; } fontID = gfxFont->getID(); ctm = state->getCTM(); state->transform(0, 0, &xt, &yt); if (!(nT3Fonts > 0 && t3FontCache[0]->matches(fontID, ctm[0], ctm[1], ctm[2], ctm[3]))) { for (i = 1; i < nT3Fonts; ++i) { if (t3FontCache[i]->matches(fontID, ctm[0], ctm[1], ctm[2], ctm[3])) { t3Font = t3FontCache[i]; for (j = i; j > 0; --j) { t3FontCache[j] = t3FontCache[j - 1]; } t3FontCache[0] = t3Font; break; } } if (i >= nT3Fonts) { if (nT3Fonts == splashOutT3FontCacheSize) { delete t3FontCache[nT3Fonts - 1]; --nT3Fonts; } for (j = nT3Fonts; j > 0; --j) { t3FontCache[j] = t3FontCache[j - 1]; } ++nT3Fonts; bbox = gfxFont->getFontBBox(); if (bbox[0] == 0 && bbox[1] == 0 && bbox[2] == 0 && bbox[3] == 0) { xMin = xt - 5; xMax = xMin + 30; yMax = yt + 15; yMin = yMax - 45; validBBox = gFalse; } else { state->transform(bbox[0], bbox[1], &x1, &y1); xMin = xMax = x1; yMin = yMax = y1; state->transform(bbox[0], bbox[3], &x1, &y1); if (x1 < xMin) { xMin = x1; } else if (x1 > xMax) { xMax = x1; } if (y1 < yMin) { yMin = y1; } else if (y1 > yMax) { yMax = y1; } state->transform(bbox[2], bbox[1], &x1, &y1); if (x1 < xMin) { xMin = x1; } else if (x1 > xMax) { xMax = x1; } if (y1 < yMin) { yMin = y1; } else if (y1 > yMax) { yMax = y1; } state->transform(bbox[2], bbox[3], &x1, &y1); if (x1 < xMin) { xMin = x1; } else if (x1 > xMax) { xMax = x1; } if (y1 < yMin) { yMin = y1; } else if (y1 > yMax) { yMax = y1; } validBBox = gTrue; } t3FontCache[0] = new T3FontCache(fontID, ctm[0], ctm[1], ctm[2], ctm[3], (int)floor(xMin - xt), (int)floor(yMin - yt), (int)ceil(xMax) - (int)floor(xMin) + 3, (int)ceil(yMax) - (int)floor(yMin) + 3, validBBox, colorMode != splashModeMono1); } } t3Font = t3FontCache[0]; i = (code & (t3Font->cacheSets - 1)) * t3Font->cacheAssoc; for (j = 0; j < t3Font->cacheAssoc; ++j) { if (t3Font->cacheTags != NULL) { if ((t3Font->cacheTags[i+j].mru & 0x8000) && t3Font->cacheTags[i+j].code == code) { drawType3Glyph(t3Font, &t3Font->cacheTags[i+j], t3Font->cacheData + (i+j) * t3Font->glyphSize); return gTrue; } } } t3gs = new T3GlyphStack(); t3gs->next = t3GlyphStack; t3GlyphStack = t3gs; t3GlyphStack->code = code; t3GlyphStack->cache = t3Font; t3GlyphStack->cacheTag = NULL; t3GlyphStack->cacheData = NULL; return gFalse; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
656
void SplashOutputDev::clearSoftMask(GfxState * /*state*/) { splash->setSoftMask(NULL); }
DoS Exec Code Overflow
0
void SplashOutputDev::clearSoftMask(GfxState * /*state*/) { splash->setSoftMask(NULL); }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
657
void SplashOutputDev::clipToStrokePath(GfxState *state) { SplashPath *path, *path2; path = convertPath(state, state->getPath()); path2 = splash->makeStrokePath(path); delete path; splash->clipToPath(path2, gFalse); delete path2; }
DoS Exec Code Overflow
0
void SplashOutputDev::clipToStrokePath(GfxState *state) { SplashPath *path, *path2; path = convertPath(state, state->getPath()); path2 = splash->makeStrokePath(path); delete path; splash->clipToPath(path2, gFalse); delete path2; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
658
SplashPath *SplashOutputDev::convertPath(GfxState * /*state*/, GfxPath *path) { SplashPath *sPath; GfxSubpath *subpath; int i, j; sPath = new SplashPath(); for (i = 0; i < path->getNumSubpaths(); ++i) { subpath = path->getSubpath(i); if (subpath->getNumPoints() > 0) { sPath->moveTo((SplashCoord)subpath->getX(0), (SplashCoord)subpath->getY(0)); j = 1; while (j < subpath->getNumPoints()) { if (subpath->getCurve(j)) { sPath->curveTo((SplashCoord)subpath->getX(j), (SplashCoord)subpath->getY(j), (SplashCoord)subpath->getX(j+1), (SplashCoord)subpath->getY(j+1), (SplashCoord)subpath->getX(j+2), (SplashCoord)subpath->getY(j+2)); j += 3; } else { sPath->lineTo((SplashCoord)subpath->getX(j), (SplashCoord)subpath->getY(j)); ++j; } } if (subpath->isClosed()) { sPath->close(); } } } return sPath; }
DoS Exec Code Overflow
0
SplashPath *SplashOutputDev::convertPath(GfxState * /*state*/, GfxPath *path) { SplashPath *sPath; GfxSubpath *subpath; int i, j; sPath = new SplashPath(); for (i = 0; i < path->getNumSubpaths(); ++i) { subpath = path->getSubpath(i); if (subpath->getNumPoints() > 0) { sPath->moveTo((SplashCoord)subpath->getX(0), (SplashCoord)subpath->getY(0)); j = 1; while (j < subpath->getNumPoints()) { if (subpath->getCurve(j)) { sPath->curveTo((SplashCoord)subpath->getX(j), (SplashCoord)subpath->getY(j), (SplashCoord)subpath->getX(j+1), (SplashCoord)subpath->getY(j+1), (SplashCoord)subpath->getX(j+2), (SplashCoord)subpath->getY(j+2)); j += 3; } else { sPath->lineTo((SplashCoord)subpath->getX(j), (SplashCoord)subpath->getY(j)); ++j; } } if (subpath->isClosed()) { sPath->close(); } } } return sPath; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
659
static void cvtHSVToRGB(int h, int s, int v, Guchar *r, Guchar *g, Guchar *b) { int x, f, cmax, cmid, cmin; if (s == 0) { *r = *g = *b = v; } else { x = h / 60; f = h % 60; cmax = v; if (x & 1) { cmid = div255(v * 255 - ((s * f) / 60)); } else { cmid = div255(v * (255 - ((s * (60 - f)) / 60))); } cmin = div255(v * (255 - s)); switch (x) { case 0: *r = cmax; *g = cmid; *b = cmin; break; case 1: *g = cmax; *r = cmid; *b = cmin; break; case 2: *g = cmax; *b = cmid; *r = cmin; break; case 3: *b = cmax; *g = cmid; *r = cmin; break; case 4: *b = cmax; *r = cmid; *g = cmin; break; case 5: *r = cmax; *b = cmid; *g = cmin; break; } } }
DoS Exec Code Overflow
0
static void cvtHSVToRGB(int h, int s, int v, Guchar *r, Guchar *g, Guchar *b) { int x, f, cmax, cmid, cmin; if (s == 0) { *r = *g = *b = v; } else { x = h / 60; f = h % 60; cmax = v; if (x & 1) { cmid = div255(v * 255 - ((s * f) / 60)); } else { cmid = div255(v * (255 - ((s * (60 - f)) / 60))); } cmin = div255(v * (255 - s)); switch (x) { case 0: *r = cmax; *g = cmid; *b = cmin; break; case 1: *g = cmax; *r = cmid; *b = cmin; break; case 2: *g = cmax; *b = cmid; *r = cmin; break; case 3: *b = cmax; *g = cmid; *r = cmin; break; case 4: *b = cmax; *r = cmid; *g = cmin; break; case 5: *r = cmax; *b = cmid; *g = cmin; break; } } }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
660
static void cvtRGBToHSV(Guchar r, Guchar g, Guchar b, int *h, int *s, int *v) { int cmax, cmid, cmin, x; if (r >= g) { if (g >= b) { x = 0; cmax = r; cmid = g; cmin = b; } else if (b >= r) { x = 4; cmax = b; cmid = r; cmin = g; } else { x = 5; cmax = r; cmid = b; cmin = g; } } else { if (r >= b) { x = 1; cmax = g; cmid = r; cmin = b; } else if (g >= b) { x = 2; cmax = g; cmid = b; cmin = r; } else { x = 3; cmax = b; cmid = g; cmin = r; } } if (cmax == cmin) { *h = *s = 0; } else { *h = x * 60; if (x & 1) { *h += ((cmax - cmid) * 60) / (cmax - cmin); } else { *h += ((cmid - cmin) * 60) / (cmax - cmin); } *s = (255 * (cmax - cmin)) / cmax; } *v = cmax; }
DoS Exec Code Overflow
0
static void cvtRGBToHSV(Guchar r, Guchar g, Guchar b, int *h, int *s, int *v) { int cmax, cmid, cmin, x; if (r >= g) { if (g >= b) { x = 0; cmax = r; cmid = g; cmin = b; } else if (b >= r) { x = 4; cmax = b; cmid = r; cmin = g; } else { x = 5; cmax = r; cmid = b; cmin = g; } } else { if (r >= b) { x = 1; cmax = g; cmid = r; cmin = b; } else if (g >= b) { x = 2; cmax = g; cmid = b; cmin = r; } else { x = 3; cmax = b; cmid = g; cmin = r; } } if (cmax == cmin) { *h = *s = 0; } else { *h = x * 60; if (x & 1) { *h += ((cmax - cmid) * 60) / (cmax - cmin); } else { *h += ((cmid - cmin) * 60) / (cmax - cmin); } *s = (255 * (cmax - cmin)) / cmax; } *v = cmax; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
661
static inline Guchar div255(int x) { return (Guchar)((x + (x >> 8) + 0x80) >> 8); }
DoS Exec Code Overflow
0
static inline Guchar div255(int x) { return (Guchar)((x + (x >> 8) + 0x80) >> 8); }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
662
void SplashOutputDev::doUpdateFont(GfxState *state) { GfxFont *gfxFont; GfxFontType fontType; SplashOutFontFileID *id; SplashFontFile *fontFile; SplashFontSrc *fontsrc = NULL; FoFiTrueType *ff; Ref embRef; Object refObj, strObj; GooString *fileName; char *tmpBuf; int tmpBufLen; Gushort *codeToGID; DisplayFontParam *dfp; double *textMat; double m11, m12, m21, m22, fontSize; SplashCoord mat[4]; int substIdx, n; int faceIndex = 0; GBool recreateFont = gFalse; GBool doAdjustFontMatrix = gFalse; needFontUpdate = gFalse; font = NULL; fileName = NULL; tmpBuf = NULL; substIdx = -1; dfp = NULL; if (!(gfxFont = state->getFont())) { goto err1; } fontType = gfxFont->getType(); if (fontType == fontType3) { goto err1; } id = new SplashOutFontFileID(gfxFont->getID()); if ((fontFile = fontEngine->getFontFile(id))) { delete id; } else { if (gfxFont->getEmbeddedFontID(&embRef)) { tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen); if (! tmpBuf) goto err2; } else if (!(fileName = gfxFont->getExtFontFile())) { dfp = NULL; if (gfxFont->getName()) { dfp = globalParams->getDisplayFont(gfxFont); } if (!dfp) { error(-1, "Couldn't find a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } switch (dfp->kind) { case displayFontT1: fileName = dfp->t1.fileName; fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1; break; case displayFontTT: fileName = dfp->tt.fileName; fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType; faceIndex = dfp->tt.faceIndex; break; } doAdjustFontMatrix = gTrue; } fontsrc = new SplashFontSrc; if (fileName) fontsrc->setFile(fileName, gFalse); else fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue); switch (fontType) { case fontType1: if (!(fontFile = fontEngine->loadType1Font( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontType1C: if (!(fontFile = fontEngine->loadType1CFont( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontType1COT: if (!(fontFile = fontEngine->loadOpenTypeT1CFont( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontTrueType: case fontTrueTypeOT: if (fileName) ff = FoFiTrueType::load(fileName->getCString()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (ff) { codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff); n = 256; delete ff; } else { codeToGID = NULL; n = 0; } if (!(fontFile = fontEngine->loadTrueTypeFont( id, fontsrc, codeToGID, n))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontCIDType0: case fontCIDType0C: if (!(fontFile = fontEngine->loadCIDFont( id, fontsrc))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontCIDType0COT: if (!(fontFile = fontEngine->loadOpenTypeCFFFont( id, fontsrc))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontCIDType2: case fontCIDType2OT: codeToGID = NULL; n = 0; if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); if (n) { codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort)); memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), n * sizeof(Gushort)); } } else { if (fileName) ff = FoFiTrueType::load(fileName->getCString()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (! ff) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n); delete ff; } if (!(fontFile = fontEngine->loadTrueTypeFont( id, fontsrc, codeToGID, n, faceIndex))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; default: goto err2; } fontFile->doAdjustMatrix = doAdjustFontMatrix; } textMat = state->getTextMat(); fontSize = state->getFontSize(); m11 = textMat[0] * fontSize * state->getHorizScaling(); m12 = textMat[1] * fontSize * state->getHorizScaling(); m21 = textMat[2] * fontSize; m22 = textMat[3] * fontSize; mat[0] = m11; mat[1] = m12; mat[2] = m21; mat[3] = m22; font = fontEngine->getFont(fontFile, mat, splash->getMatrix()); if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) { double w1, w2; CharCode code; char *name; for (code = 0; code < 256; ++code) { if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) && name[0] == 'm' && name[1] == '\0') { break; } } if (code < 256) { w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code); w2 = font->getGlyphAdvance(code); if (!gfxFont->isSymbolic() && w2 > 0) { if (w1 > 0.01 && w1 < 0.9 * w2) { w1 /= w2; m11 *= w1; m21 *= w1; recreateFont = gTrue; } } } } if (recreateFont) { mat[0] = m11; mat[1] = m12; mat[2] = m21; mat[3] = m22; font = fontEngine->getFont(fontFile, mat, splash->getMatrix()); } if (fontsrc && !fontsrc->isFile) fontsrc->unref(); return; err2: delete id; err1: if (fontsrc && !fontsrc->isFile) fontsrc->unref(); return; }
DoS Exec Code Overflow
0
void SplashOutputDev::doUpdateFont(GfxState *state) { GfxFont *gfxFont; GfxFontType fontType; SplashOutFontFileID *id; SplashFontFile *fontFile; SplashFontSrc *fontsrc = NULL; FoFiTrueType *ff; Ref embRef; Object refObj, strObj; GooString *fileName; char *tmpBuf; int tmpBufLen; Gushort *codeToGID; DisplayFontParam *dfp; double *textMat; double m11, m12, m21, m22, fontSize; SplashCoord mat[4]; int substIdx, n; int faceIndex = 0; GBool recreateFont = gFalse; GBool doAdjustFontMatrix = gFalse; needFontUpdate = gFalse; font = NULL; fileName = NULL; tmpBuf = NULL; substIdx = -1; dfp = NULL; if (!(gfxFont = state->getFont())) { goto err1; } fontType = gfxFont->getType(); if (fontType == fontType3) { goto err1; } id = new SplashOutFontFileID(gfxFont->getID()); if ((fontFile = fontEngine->getFontFile(id))) { delete id; } else { if (gfxFont->getEmbeddedFontID(&embRef)) { tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen); if (! tmpBuf) goto err2; } else if (!(fileName = gfxFont->getExtFontFile())) { dfp = NULL; if (gfxFont->getName()) { dfp = globalParams->getDisplayFont(gfxFont); } if (!dfp) { error(-1, "Couldn't find a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } switch (dfp->kind) { case displayFontT1: fileName = dfp->t1.fileName; fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1; break; case displayFontTT: fileName = dfp->tt.fileName; fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType; faceIndex = dfp->tt.faceIndex; break; } doAdjustFontMatrix = gTrue; } fontsrc = new SplashFontSrc; if (fileName) fontsrc->setFile(fileName, gFalse); else fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue); switch (fontType) { case fontType1: if (!(fontFile = fontEngine->loadType1Font( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontType1C: if (!(fontFile = fontEngine->loadType1CFont( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontType1COT: if (!(fontFile = fontEngine->loadOpenTypeT1CFont( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontTrueType: case fontTrueTypeOT: if (fileName) ff = FoFiTrueType::load(fileName->getCString()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (ff) { codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff); n = 256; delete ff; } else { codeToGID = NULL; n = 0; } if (!(fontFile = fontEngine->loadTrueTypeFont( id, fontsrc, codeToGID, n))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontCIDType0: case fontCIDType0C: if (!(fontFile = fontEngine->loadCIDFont( id, fontsrc))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontCIDType0COT: if (!(fontFile = fontEngine->loadOpenTypeCFFFont( id, fontsrc))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; case fontCIDType2: case fontCIDType2OT: codeToGID = NULL; n = 0; if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); if (n) { codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort)); memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), n * sizeof(Gushort)); } } else { if (fileName) ff = FoFiTrueType::load(fileName->getCString()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (! ff) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n); delete ff; } if (!(fontFile = fontEngine->loadTrueTypeFont( id, fontsrc, codeToGID, n, faceIndex))) { error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); goto err2; } break; default: goto err2; } fontFile->doAdjustMatrix = doAdjustFontMatrix; } textMat = state->getTextMat(); fontSize = state->getFontSize(); m11 = textMat[0] * fontSize * state->getHorizScaling(); m12 = textMat[1] * fontSize * state->getHorizScaling(); m21 = textMat[2] * fontSize; m22 = textMat[3] * fontSize; mat[0] = m11; mat[1] = m12; mat[2] = m21; mat[3] = m22; font = fontEngine->getFont(fontFile, mat, splash->getMatrix()); if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) { double w1, w2; CharCode code; char *name; for (code = 0; code < 256; ++code) { if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) && name[0] == 'm' && name[1] == '\0') { break; } } if (code < 256) { w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code); w2 = font->getGlyphAdvance(code); if (!gfxFont->isSymbolic() && w2 > 0) { if (w1 > 0.01 && w1 < 0.9 * w2) { w1 /= w2; m11 *= w1; m21 *= w1; recreateFont = gTrue; } } } } if (recreateFont) { mat[0] = m11; mat[1] = m12; mat[2] = m21; mat[3] = m22; font = fontEngine->getFont(fontFile, mat, splash->getMatrix()); } if (fontsrc && !fontsrc->isFile) fontsrc->unref(); return; err2: delete id; err1: if (fontsrc && !fontsrc->isFile) fontsrc->unref(); return; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
663
void SplashOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen) { SplashPath *path; int render; render = state->getRender(); if (render == 3) { return; } if (needFontUpdate) { doUpdateFont(state); } if (!font) { return; } x -= originX; y -= originY; if (!(render & 1)) { if (!state->getFillColorSpace()->isNonMarking()) { splash->fillChar((SplashCoord)x, (SplashCoord)y, code, font); } } if ((render & 3) == 1 || (render & 3) == 2) { if (!state->getStrokeColorSpace()->isNonMarking()) { if ((path = font->getGlyphPath(code))) { path->offset((SplashCoord)x, (SplashCoord)y); splash->stroke(path); delete path; } } } if (render & 4) { if ((path = font->getGlyphPath(code))) { path->offset((SplashCoord)x, (SplashCoord)y); if (textClipPath) { textClipPath->append(path); delete path; } else { textClipPath = path; } } } }
DoS Exec Code Overflow
0
void SplashOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen) { SplashPath *path; int render; render = state->getRender(); if (render == 3) { return; } if (needFontUpdate) { doUpdateFont(state); } if (!font) { return; } x -= originX; y -= originY; if (!(render & 1)) { if (!state->getFillColorSpace()->isNonMarking()) { splash->fillChar((SplashCoord)x, (SplashCoord)y, code, font); } } if ((render & 3) == 1 || (render & 3) == 2) { if (!state->getStrokeColorSpace()->isNonMarking()) { if ((path = font->getGlyphPath(code))) { path->offset((SplashCoord)x, (SplashCoord)y); splash->stroke(path); delete path; } } } if (render & 4) { if ((path = font->getGlyphPath(code))) { path->offset((SplashCoord)x, (SplashCoord)y); if (textClipPath) { textClipPath->append(path); delete path; } else { textClipPath = path; } } } }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
664
void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) { double *ctm; SplashCoord mat[6]; SplashOutImageMaskData imgMaskData; if (state->getFillColorSpace()->isNonMarking()) { return; } ctm = state->getCTM(); mat[0] = ctm[0]; mat[1] = ctm[1]; mat[2] = -ctm[2]; mat[3] = -ctm[3]; mat[4] = ctm[2] + ctm[4]; mat[5] = ctm[3] + ctm[5]; imgMaskData.imgStr = new ImageStream(str, width, 1, 1); imgMaskData.imgStr->reset(); imgMaskData.invert = invert ? 0 : 1; imgMaskData.width = width; imgMaskData.height = height; imgMaskData.y = 0; splash->fillImageMask(&imageMaskSrc, &imgMaskData, width, height, mat, t3GlyphStack != NULL); if (inlineImg) { while (imgMaskData.y < height) { imgMaskData.imgStr->getLine(); ++imgMaskData.y; } } delete imgMaskData.imgStr; str->close(); }
DoS Exec Code Overflow
0
void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) { double *ctm; SplashCoord mat[6]; SplashOutImageMaskData imgMaskData; if (state->getFillColorSpace()->isNonMarking()) { return; } ctm = state->getCTM(); mat[0] = ctm[0]; mat[1] = ctm[1]; mat[2] = -ctm[2]; mat[3] = -ctm[3]; mat[4] = ctm[2] + ctm[4]; mat[5] = ctm[3] + ctm[5]; imgMaskData.imgStr = new ImageStream(str, width, 1, 1); imgMaskData.imgStr->reset(); imgMaskData.invert = invert ? 0 : 1; imgMaskData.width = width; imgMaskData.height = height; imgMaskData.y = 0; splash->fillImageMask(&imageMaskSrc, &imgMaskData, width, height, mat, t3GlyphStack != NULL); if (inlineImg) { while (imgMaskData.y < height) { imgMaskData.imgStr->getLine(); ++imgMaskData.y; } } delete imgMaskData.imgStr; str->close(); }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
665
void SplashOutputDev::drawType3Glyph(T3FontCache *t3Font, T3FontCacheTag * /*tag*/, Guchar *data) { SplashGlyphBitmap glyph; glyph.x = -t3Font->glyphX; glyph.y = -t3Font->glyphY; glyph.w = t3Font->glyphW; glyph.h = t3Font->glyphH; glyph.aa = colorMode != splashModeMono1; glyph.data = data; glyph.freeData = gFalse; splash->fillGlyph(0, 0, &glyph); }
DoS Exec Code Overflow
0
void SplashOutputDev::drawType3Glyph(T3FontCache *t3Font, T3FontCacheTag * /*tag*/, Guchar *data) { SplashGlyphBitmap glyph; glyph.x = -t3Font->glyphX; glyph.y = -t3Font->glyphY; glyph.w = t3Font->glyphW; glyph.h = t3Font->glyphH; glyph.aa = colorMode != splashModeMono1; glyph.data = data; glyph.freeData = gFalse; splash->fillGlyph(0, 0, &glyph); }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
666
void SplashOutputDev::endPage() { if (colorMode != splashModeMono1) { splash->compositeBackground(paperColor); } }
DoS Exec Code Overflow
0
void SplashOutputDev::endPage() { if (colorMode != splashModeMono1) { splash->compositeBackground(paperColor); } }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
667
void SplashOutputDev::endTextObject(GfxState *state) { if (textClipPath) { splash->clipToPath(textClipPath, gFalse); delete textClipPath; textClipPath = NULL; } }
DoS Exec Code Overflow
0
void SplashOutputDev::endTextObject(GfxState *state) { if (textClipPath) { splash->clipToPath(textClipPath, gFalse); delete textClipPath; textClipPath = NULL; } }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
668
void SplashOutputDev::endTransparencyGroup(GfxState *state) { double *ctm; delete splash; bitmap = transpGroupStack->origBitmap; splash = transpGroupStack->origSplash; ctm = state->getCTM(); state->shiftCTM(transpGroupStack->tx, transpGroupStack->ty); updateCTM(state, 0, 0, 0, 0, 0, 0); }
DoS Exec Code Overflow
0
void SplashOutputDev::endTransparencyGroup(GfxState *state) { double *ctm; delete splash; bitmap = transpGroupStack->origBitmap; splash = transpGroupStack->origSplash; ctm = state->getCTM(); state->shiftCTM(transpGroupStack->tx, transpGroupStack->ty); updateCTM(state, 0, 0, 0, 0, 0, 0); }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
669
void SplashOutputDev::eoFill(GfxState *state) { SplashPath *path; if (state->getFillColorSpace()->isNonMarking()) { return; } path = convertPath(state, state->getPath()); splash->fill(path, gTrue); delete path; }
DoS Exec Code Overflow
0
void SplashOutputDev::eoFill(GfxState *state) { SplashPath *path; if (state->getFillColorSpace()->isNonMarking()) { return; } path = convertPath(state, state->getPath()); splash->fill(path, gTrue); delete path; }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
670
int SplashOutputDev::getBitmapHeight() { return bitmap->getHeight(); }
DoS Exec Code Overflow
0
int SplashOutputDev::getBitmapHeight() { return bitmap->getHeight(); }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
671
int SplashOutputDev::getBitmapWidth() { return bitmap->getWidth(); }
DoS Exec Code Overflow
0
int SplashOutputDev::getBitmapWidth() { return bitmap->getWidth(); }
@@ -2023,7 +2023,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } break; case splashModeXBGR8: - imgData.lookup = (SplashColorPtr)gmallocn(n, 3); + imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { pix = (Guchar)i; colorMap->getRGB(&pix, &rgb);
CWE-189
null
null
672
GBool ArthurOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { return gFalse; }
DoS Exec Code Overflow
0
GBool ArthurOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { return gFalse; }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
673
static QPainterPath convertPath(GfxState *state, GfxPath *path, Qt::FillRule fillRule) { GfxSubpath *subpath; double x1, y1, x2, y2, x3, y3; int i, j; QPainterPath qPath; qPath.setFillRule(fillRule); for (i = 0; i < path->getNumSubpaths(); ++i) { subpath = path->getSubpath(i); if (subpath->getNumPoints() > 0) { state->transform(subpath->getX(0), subpath->getY(0), &x1, &y1); qPath.moveTo(x1, y1); j = 1; while (j < subpath->getNumPoints()) { if (subpath->getCurve(j)) { state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); state->transform(subpath->getX(j+1), subpath->getY(j+1), &x2, &y2); state->transform(subpath->getX(j+2), subpath->getY(j+2), &x3, &y3); qPath.cubicTo( x1, y1, x2, y2, x3, y3); j += 3; } else { state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); qPath.lineTo(x1, y1); ++j; } } if (subpath->isClosed()) { qPath.closeSubpath(); } } } return qPath; }
DoS Exec Code Overflow
0
static QPainterPath convertPath(GfxState *state, GfxPath *path, Qt::FillRule fillRule) { GfxSubpath *subpath; double x1, y1, x2, y2, x3, y3; int i, j; QPainterPath qPath; qPath.setFillRule(fillRule); for (i = 0; i < path->getNumSubpaths(); ++i) { subpath = path->getSubpath(i); if (subpath->getNumPoints() > 0) { state->transform(subpath->getX(0), subpath->getY(0), &x1, &y1); qPath.moveTo(x1, y1); j = 1; while (j < subpath->getNumPoints()) { if (subpath->getCurve(j)) { state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); state->transform(subpath->getX(j+1), subpath->getY(j+1), &x2, &y2); state->transform(subpath->getX(j+2), subpath->getY(j+2), &x3, &y3); qPath.cubicTo( x1, y1, x2, y2, x3, y3); j += 3; } else { state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); qPath.lineTo(x1, y1); ++j; } } if (subpath->isClosed()) { qPath.closeSubpath(); } } } return qPath; }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
674
void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) { qDebug() << "drawImageMask"; #if 0 unsigned char *buffer; unsigned char *dest; cairo_surface_t *image; cairo_pattern_t *pattern; int x, y; ImageStream *imgStr; Guchar *pix; double *ctm; cairo_matrix_t matrix; int invert_bit; int row_stride; row_stride = (width + 3) & ~3; buffer = (unsigned char *) malloc (height * row_stride); if (buffer == NULL) { error(-1, "Unable to allocate memory for image."); return; } /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, 1, 1); imgStr->reset(); invert_bit = invert ? 1 : 0; for (y = 0; y < height; y++) { pix = imgStr->getLine(); dest = buffer + y * row_stride; for (x = 0; x < width; x++) { if (pix[x] ^ invert_bit) *dest++ = 0; else *dest++ = 255; } } image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_A8, width, height, row_stride); if (image == NULL) return; pattern = cairo_pattern_create_for_surface (image); if (pattern == NULL) return; ctm = state->getCTM(); LOG (printf ("drawImageMask %dx%d, matrix: %f, %f, %f, %f, %f, %f\n", width, height, ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5])); matrix.xx = ctm[0] / width; matrix.xy = -ctm[2] / height; matrix.yx = ctm[1] / width; matrix.yy = -ctm[3] / height; matrix.x0 = ctm[2] + ctm[4]; matrix.y0 = ctm[3] + ctm[5]; cairo_matrix_invert (&matrix); cairo_pattern_set_matrix (pattern, &matrix); cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST); /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source_rgb (cairo, fill_color.r, fill_color.g, fill_color.b); cairo_mask (cairo, pattern); cairo_pattern_destroy (pattern); cairo_surface_destroy (image); free (buffer); delete imgStr; #endif }
DoS Exec Code Overflow
0
void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) { qDebug() << "drawImageMask"; #if 0 unsigned char *buffer; unsigned char *dest; cairo_surface_t *image; cairo_pattern_t *pattern; int x, y; ImageStream *imgStr; Guchar *pix; double *ctm; cairo_matrix_t matrix; int invert_bit; int row_stride; row_stride = (width + 3) & ~3; buffer = (unsigned char *) malloc (height * row_stride); if (buffer == NULL) { error(-1, "Unable to allocate memory for image."); return; } /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, 1, 1); imgStr->reset(); invert_bit = invert ? 1 : 0; for (y = 0; y < height; y++) { pix = imgStr->getLine(); dest = buffer + y * row_stride; for (x = 0; x < width; x++) { if (pix[x] ^ invert_bit) *dest++ = 0; else *dest++ = 255; } } image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_A8, width, height, row_stride); if (image == NULL) return; pattern = cairo_pattern_create_for_surface (image); if (pattern == NULL) return; ctm = state->getCTM(); LOG (printf ("drawImageMask %dx%d, matrix: %f, %f, %f, %f, %f, %f\n", width, height, ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5])); matrix.xx = ctm[0] / width; matrix.xy = -ctm[2] / height; matrix.yx = ctm[1] / width; matrix.yy = -ctm[3] / height; matrix.x0 = ctm[2] + ctm[4]; matrix.y0 = ctm[3] + ctm[5]; cairo_matrix_invert (&matrix); cairo_pattern_set_matrix (pattern, &matrix); cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST); /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source_rgb (cairo, fill_color.r, fill_color.g, fill_color.b); cairo_mask (cairo, pattern); cairo_pattern_destroy (pattern); cairo_surface_destroy (image); free (buffer); delete imgStr; #endif }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
675
void ArthurOutputDev::drawLink(Link *link, Catalog *catalog) { }
DoS Exec Code Overflow
0
void ArthurOutputDev::drawLink(Link *link, Catalog *catalog) { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
676
void ArthurOutputDev::endPage() { }
DoS Exec Code Overflow
0
void ArthurOutputDev::endPage() { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
677
void ArthurOutputDev::endTextObject(GfxState *state) { }
DoS Exec Code Overflow
0
void ArthurOutputDev::endTextObject(GfxState *state) { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
678
void ArthurOutputDev::endType3Char(GfxState *state) { }
DoS Exec Code Overflow
0
void ArthurOutputDev::endType3Char(GfxState *state) { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
679
void ArthurOutputDev::eoFill(GfxState *state) { m_painter->fillPath( convertPath( state, state->getPath(), Qt::OddEvenFill ), m_currentBrush ); }
DoS Exec Code Overflow
0
void ArthurOutputDev::eoFill(GfxState *state) { m_painter->fillPath( convertPath( state, state->getPath(), Qt::OddEvenFill ), m_currentBrush ); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
680
void ArthurOutputDev::fill(GfxState *state) { m_painter->fillPath( convertPath( state, state->getPath(), Qt::WindingFill ), m_currentBrush ); }
DoS Exec Code Overflow
0
void ArthurOutputDev::fill(GfxState *state) { m_painter->fillPath( convertPath( state, state->getPath(), Qt::WindingFill ), m_currentBrush ); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
681
GBool matches(SplashFontFileID *id) { return ((SplashOutFontFileID *)id)->r.num == r.num && ((SplashOutFontFileID *)id)->r.gen == r.gen; }
DoS Exec Code Overflow
0
GBool matches(SplashFontFileID *id) { return ((SplashOutFontFileID *)id)->r.num == r.num && ((SplashOutFontFileID *)id)->r.gen == r.gen; }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
682
void ArthurOutputDev::restoreState(GfxState *state) { m_painter->restore(); }
DoS Exec Code Overflow
0
void ArthurOutputDev::restoreState(GfxState *state) { m_painter->restore(); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
683
void ArthurOutputDev::saveState(GfxState *state) { m_painter->save(); }
DoS Exec Code Overflow
0
void ArthurOutputDev::saveState(GfxState *state) { m_painter->save(); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
684
void ArthurOutputDev::startPage(int pageNum, GfxState *state) { int w = static_cast<int>(state->getPageWidth()); int h = static_cast<int>(state->getPageHeight()); QColor fillColour(Qt::white); QBrush fill(fillColour); m_painter->save(); m_painter->setPen(fillColour); m_painter->setBrush(fill); m_painter->drawRect(0, 0, w, h); m_painter->restore(); }
DoS Exec Code Overflow
0
void ArthurOutputDev::startPage(int pageNum, GfxState *state) { int w = static_cast<int>(state->getPageWidth()); int h = static_cast<int>(state->getPageHeight()); QColor fillColour(Qt::white); QBrush fill(fillColour); m_painter->save(); m_painter->setPen(fillColour); m_painter->setBrush(fill); m_painter->drawRect(0, 0, w, h); m_painter->restore(); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
685
void ArthurOutputDev::stroke(GfxState *state) { m_painter->drawPath( convertPath( state, state->getPath(), Qt::OddEvenFill ) ); }
DoS Exec Code Overflow
0
void ArthurOutputDev::stroke(GfxState *state) { m_painter->drawPath( convertPath( state, state->getPath(), Qt::OddEvenFill ) ); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
686
void ArthurOutputDev::type3D0(GfxState *state, double wx, double wy) { }
DoS Exec Code Overflow
0
void ArthurOutputDev::type3D0(GfxState *state, double wx, double wy) { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
687
void ArthurOutputDev::type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury) { }
DoS Exec Code Overflow
0
void ArthurOutputDev::type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury) { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
688
void ArthurOutputDev::updateAll(GfxState *state) { OutputDev::updateAll(state); m_needFontUpdate = gTrue; }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateAll(GfxState *state) { OutputDev::updateAll(state); m_needFontUpdate = gTrue; }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
689
void ArthurOutputDev::updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) { updateLineDash(state); updateLineJoin(state); updateLineCap(state); updateLineWidth(state); }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) { updateLineDash(state); updateLineJoin(state); updateLineCap(state); updateLineWidth(state); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
690
void ArthurOutputDev::updateFillColor(GfxState *state) { GfxRGB rgb; QColor brushColour = m_currentBrush.color(); state->getFillRGB(&rgb); brushColour.setRgbF(colToDbl(rgb.r), colToDbl(rgb.g), colToDbl(rgb.b), brushColour.alphaF()); m_currentBrush.setColor(brushColour); }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateFillColor(GfxState *state) { GfxRGB rgb; QColor brushColour = m_currentBrush.color(); state->getFillRGB(&rgb); brushColour.setRgbF(colToDbl(rgb.r), colToDbl(rgb.g), colToDbl(rgb.b), brushColour.alphaF()); m_currentBrush.setColor(brushColour); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
691
void ArthurOutputDev::updateFillOpacity(GfxState *state) { QColor brushColour= m_currentBrush.color(); brushColour.setAlphaF(state->getFillOpacity()); m_currentBrush.setColor(brushColour); }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateFillOpacity(GfxState *state) { QColor brushColour= m_currentBrush.color(); brushColour.setAlphaF(state->getFillOpacity()); m_currentBrush.setColor(brushColour); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
692
void ArthurOutputDev::updateFlatness(GfxState *state) { }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateFlatness(GfxState *state) { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
693
void ArthurOutputDev::updateLineCap(GfxState *state) { switch (state->getLineCap()) { case 0: m_currentPen.setCapStyle(Qt::FlatCap); break; case 1: m_currentPen.setCapStyle(Qt::RoundCap); break; case 2: m_currentPen.setCapStyle(Qt::SquareCap); break; } m_painter->setPen(m_currentPen); }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateLineCap(GfxState *state) { switch (state->getLineCap()) { case 0: m_currentPen.setCapStyle(Qt::FlatCap); break; case 1: m_currentPen.setCapStyle(Qt::RoundCap); break; case 2: m_currentPen.setCapStyle(Qt::SquareCap); break; } m_painter->setPen(m_currentPen); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
694
void ArthurOutputDev::updateLineDash(GfxState *state) { }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateLineDash(GfxState *state) { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
695
void ArthurOutputDev::updateMiterLimit(GfxState *state) { }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateMiterLimit(GfxState *state) { }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
696
void ArthurOutputDev::updateStrokeColor(GfxState *state) { GfxRGB rgb; QColor penColour = m_currentPen.color(); state->getStrokeRGB(&rgb); penColour.setRgbF(colToDbl(rgb.r), colToDbl(rgb.g), colToDbl(rgb.b), penColour.alphaF()); m_currentPen.setColor(penColour); m_painter->setPen(m_currentPen); }
DoS Exec Code Overflow
0
void ArthurOutputDev::updateStrokeColor(GfxState *state) { GfxRGB rgb; QColor penColour = m_currentPen.color(); state->getStrokeRGB(&rgb); penColour.setRgbF(colToDbl(rgb.r), colToDbl(rgb.g), colToDbl(rgb.b), penColour.alphaF()); m_currentPen.setColor(penColour); m_painter->setPen(m_currentPen); }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
697
ArthurOutputDev::~ArthurOutputDev() { delete m_fontEngine; }
DoS Exec Code Overflow
0
ArthurOutputDev::~ArthurOutputDev() { delete m_fontEngine; }
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
698
~SplashOutFontFileID() {}
DoS Exec Code Overflow
0
~SplashOutFontFileID() {}
@@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2005-2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2009 Albert Astals Cid <[email protected]> // Copyright (C) 2008 Pino Toscano <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -751,7 +751,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, QMatrix matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3(width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null
699
CairoImage::CairoImage (double x1, double y1, double x2, double y2) { this->image = NULL; this->x1 = x1; this->y1 = y1; this->x2 = x2; this->y2 = y2; }
DoS Exec Code Overflow
0
CairoImage::CairoImage (double x1, double y1, double x2, double y2) { this->image = NULL; this->x1 = x1; this->y1 = y1; this->x2 = x2; this->y2 = y2; }
@@ -16,7 +16,7 @@ // // Copyright (C) 2005-2008 Jeff Muizelaar <[email protected]> // Copyright (C) 2005, 2006 Kristian Høgsberg <[email protected]> -// Copyright (C) 2005 Albert Astals Cid <[email protected]> +// Copyright (C) 2005, 2009 Albert Astals Cid <[email protected]> // Copyright (C) 2005 Nickolay V. Shmyrev <[email protected]> // Copyright (C) 2006-2008 Carlos Garcia Campos <[email protected]> // Copyright (C) 2008 Carl Worth <[email protected]> @@ -611,7 +611,7 @@ void CairoOutputDev::beginString(GfxState *state, GooString *s) if (!currentFont) return; - glyphs = (cairo_glyph_t *) gmalloc (len * sizeof (cairo_glyph_t)); + glyphs = (cairo_glyph_t *) gmallocn (len, sizeof (cairo_glyph_t)); glyphCount = 0; } @@ -1461,7 +1461,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, int row_stride = (maskWidth + 3) & ~3; unsigned char *maskBuffer; - maskBuffer = (unsigned char *)gmalloc (row_stride * maskHeight); + maskBuffer = (unsigned char *)gmallocn (row_stride, maskHeight); unsigned char *maskDest; cairo_surface_t *maskImage; cairo_pattern_t *maskPattern; @@ -1497,7 +1497,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, cairo_matrix_t matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3 (width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, @@ -1586,7 +1586,7 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s int row_stride = (maskWidth + 3) & ~3; unsigned char *maskBuffer; - maskBuffer = (unsigned char *)gmalloc (row_stride * maskHeight); + maskBuffer = (unsigned char *)gmallocn (row_stride, maskHeight); unsigned char *maskDest; cairo_surface_t *maskImage; cairo_pattern_t *maskPattern; @@ -1613,7 +1613,7 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s cairo_matrix_t maskMatrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3 (width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, @@ -1705,7 +1705,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, cairo_matrix_t matrix; int is_identity_transform; - buffer = (unsigned char *)gmalloc (width * height * 4); + buffer = (unsigned char *)gmallocn3 (width, height, 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width,
CWE-189
null
null