Index: head/graphics/gd/files/patch-bdftogd =================================================================== --- head/graphics/gd/files/patch-bdftogd (revision 432709) +++ head/graphics/gd/files/patch-bdftogd (revision 432710) @@ -1,68 +1,68 @@ ---- src/bdftogd.orig 2013-06-25 11:58:23.000000000 +0200 -+++ src/bdftogd 2013-08-15 21:03:29.000000000 +0200 -@@ -24,6 +24,9 @@ +--- src/bdftogd.orig 2017-01-29 09:45:57 UTC ++++ src/bdftogd +@@ -24,6 +24,9 @@ $gdname = 'gd' . $gdname unless $gdname my $filename = shift; $filename = 'gd' . $filename unless $filename =~ /^gd/i; +my $gdfunc = $gdname; +$gdfunc =~ s/(.*Font)(.*)/$1Get$2/; + if (-f "$filename.c") { die "File $filename.c already exists, won't overwrite\n"; } if (-f "$filename.h") { die "File $filename.h already exists, won't overwrite\n"; } -@@ -139,6 +142,10 @@ +@@ -139,6 +142,10 @@ print FILEC <<"EOF"; $info +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "$filename.h" char ${gdname}Data[] = { -@@ -177,28 +184,40 @@ +@@ -177,28 +184,40 @@ gdFont ${gdname}Rep = { ${gdname}Data }; -gdFontPtr ${gdname} = &${gdname}Rep; +BGD_EXPORT_DATA_PROT gdFontPtr ${gdname} = &${gdname}Rep; -/* This file has not been truncated. */ +BGD_DECLARE(gdFontPtr) +$gdfunc (void) +{ + return $gdname; +} +/* This file has not been truncated. */ EOF close FILEC; print FILEH <<"EOF"; - #ifndef $capdef #define $capdef 1 +#ifdef __cplusplus +extern "C" { +#endif + $info #include "gd.h" -extern gdFontPtr $gdname; +extern BGD_EXPORT_DATA_PROT gdFontPtr $gdname; +BGD_DECLARE(gdFontPtr) $gdfunc(void); +#ifdef __cplusplus +} #endif +#endif EOF 1; Index: head/graphics/gd/files/patch-gd_png.c =================================================================== --- head/graphics/gd/files/patch-gd_png.c (revision 432709) +++ head/graphics/gd/files/patch-gd_png.c (revision 432710) @@ -1,17 +1,17 @@ ---- src/gd_png.c.orig 2013-06-25 11:58:23.000000000 +0200 -+++ src/gd_png.c 2013-08-01 07:08:18.000000000 +0200 -@@ -196,6 +196,14 @@ +--- src/gd_png.c.orig 2016-10-12 08:13:44 UTC ++++ src/gd_png.c +@@ -277,6 +277,14 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFro png_read_info (png_ptr, info_ptr); /* read all PNG info up to image data */ png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL); + + if (overflow2(sizeof (int), width)) { + return NULL; + } + if (overflow2(sizeof (int) * width, height)) { + return NULL; + } + if ((color_type == PNG_COLOR_TYPE_RGB) || (color_type == PNG_COLOR_TYPE_RGB_ALPHA) || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { im = gdImageCreateTrueColor ((int) width, (int) height); Index: head/graphics/gd/files/patch-gdtest.c =================================================================== --- head/graphics/gd/files/patch-gdtest.c (revision 432709) +++ head/graphics/gd/files/patch-gdtest.c (revision 432710) @@ -1,58 +1,58 @@ ---- src/gdtest.c.orig 2013-06-25 11:58:23.000000000 +0200 -+++ src/gdtest.c 2013-08-01 07:12:08.000000000 +0200 -@@ -35,6 +35,8 @@ +--- src/gdtest.c.orig 2015-09-16 11:34:29 UTC ++++ src/gdtest.c +@@ -35,6 +35,8 @@ main (int argc, char **argv) gdSink imgsnk; int foreground; int i; + gdIOCtx *ctx; + if (argc != 2) { fprintf(stderr, "Usage: gdtest filename.png\n"); exit (1); -@@ -55,6 +57,35 @@ +@@ -63,6 +65,35 @@ main (int argc, char **argv) CompareImages ("Initial Versions", ref, im); + /* */ + /* Send to GIF File then Ptr */ + /* */ + sprintf(of, "%s.gif", argv[1]); + out = fopen(of, "wb"); + gdImageGif(im, out); + fclose(out); + + in = fopen(of, "rb"); + if (!in) { + fprintf(stderr, "GIF Output file does not exist!\n"); + exit(1); + } + im2 = gdImageCreateFromGif(in); + fclose(in); + + CompareImages("GD->GIF File->GD", ref, im2); + + unlink(of); + gdImageDestroy(im2); + + iptr = gdImageGifPtr(im,&sz); + ctx = gdNewDynamicCtx(sz,iptr); + im2 = gdImageCreateFromGifCtx(ctx); + + CompareImages("GD->GIF ptr->GD", ref, im2); + + gdImageDestroy(im2); + ctx->gd_free(ctx); /* */ /* Send to PNG File then Ptr */ -@@ -268,6 +299,10 @@ +@@ -334,6 +365,10 @@ main (int argc, char **argv) printf ("[Merged Image has %d colours]\n", im2->colorsTotal); CompareImages ("Merged (gdtest.png, gdtest_merge.png)", im2, im3); + out = fopen ("test/gdtest_merge_out.png", "wb"); + gdImagePng(im2, out); + fclose(out); + gdImageDestroy (im2); gdImageDestroy (im3);