diff options
| author | Josh Andler <scislac@gmail.com> | 2009-10-04 21:03:42 +0000 |
|---|---|---|
| committer | scislac <scislac@users.sourceforge.net> | 2009-10-04 21:03:42 +0000 |
| commit | cac562481b8ba45f87f46d163c244dbb849f781e (patch) | |
| tree | f282f9e581bcbe193dd45642233e6115d300a369 /src | |
| parent | Patch to fix 205667 by Petteri Aimonen (diff) | |
| download | inkscape-cac562481b8ba45f87f46d163c244dbb849f781e.tar.gz inkscape-cac562481b8ba45f87f46d163c244dbb849f781e.zip | |
Patch by Adib to fix 273767
(bzr r8713)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/pixbuf-ops.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index f41342e42..1e43df5f3 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -98,7 +98,6 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, { - GdkPixbuf* pixbuf = NULL; /* Create new arena for offscreen rendering*/ NRArena *arena = NRArena::create(); @@ -141,7 +140,12 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, nr_arena_item_invoke_update(root, &final_bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE); - guchar *px = g_try_new(guchar, 4L * width * height); + guchar *px = NULL; + guint64 size = 4L * (guint64)width * (guint64)height; + if(size < (guint64)G_MAXSIZE) { + // g_try_new is limited to g_size type which is defined as unisgned int. Need to test for very large nubers + px = g_try_new(guchar, size); + } if(px != NULL) { @@ -158,15 +162,15 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, dtc[2] = NR_RGBA32_B(bgcolor); dtc[3] = NR_RGBA32_A(bgcolor); - for (unsigned int fy = 0; fy < height; fy++) { - guchar *p = NR_PIXBLOCK_PX(&B) + fy * B.rs; + for (gsize fy = 0; fy < height; fy++) { + guchar *p = NR_PIXBLOCK_PX(&B) + fy * (gsize)B.rs; for (unsigned int fx = 0; fx < width; fx++) { for (int i = 0; i < 4; i++) { *p++ = dtc[i]; } } } - + nr_arena_item_invoke_render(NULL, root, &final_bbox, &B, NR_ARENA_ITEM_RENDER_NO_CACHE ); @@ -178,7 +182,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, } else { - g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %ld.", 4L * width * height); + g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %lld.", size); } sp_item_invoke_hide (SP_ITEM(sp_document_root(doc)), dkey); nr_object_unref((NRObject *) arena); |
