Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tip mingw build #2

Closed
imazen-bot opened this issue Feb 5, 2015 · 1 comment
Closed

fix tip mingw build #2

imazen-bot opened this issue Feb 5, 2015 · 1 comment

Comments

@imazen-bot
Copy link

diff -ru8i src/gd_filter.c src.new/gd_filter.c
--- src/gd_filter.c 2011-05-14 13:38:26 +0800
+++ src.new/gd_filter.c 2011-06-17 10:25:10 +0800
@@ -13,28 +13,28 @@
 #define GET_PIXEL_FUNCTION(src)(src->trueColor ? gdImageGetTrueColorPixel : gdImageGetPixel)

 #ifdef WIN32
 # define GD_SCATTER_SEED() (unsigned int)(time(0) * GetCurrentProcessId())
 #else
 # define GD_SCATTER_SEED() (unsigned int)(time(0) * getpid())
 #endif

-int gdImageScatter(gdImagePtr im, int sub, int plus)
+BGD_DECLARE(int) gdImageScatter(gdImagePtr im, int sub, int plus)
 {
    gdScatter s;

    s.sub  = sub;
    s.plus = plus;
    s.num_colors = 0;
    s.seed = GD_SCATTER_SEED();
    return gdImageScatterEx(im, &s);
 }

-int gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors)
+BGD_DECLARE(int) gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors)
 {
    gdScatter s;

    s.sub  = sub;
    s.plus = plus;
    s.colors = colors;
    s.num_colors = num_colors;
    s.seed = GD_SCATTER_SEED();
@@ -48,17 +48,17 @@
        if (!gdImageBoundsSafe(im, dest_x, dest_y)) {           \
            continue;                                           \
        }                                                       \
                                                                \
        pxl = f(im, x, y);                                      \
        new_pxl = f(im, dest_x, dest_y);                        \
    } while (0)

-int gdImageScatterEx(gdImagePtr im, gdScatterPtr scatter)
+BGD_DECLARE(int) gdImageScatterEx(gdImagePtr im, gdScatterPtr scatter)
 {
    register int x, y;
    int dest_x, dest_y;
    int pxl, new_pxl;
    unsigned int n;
    int sub = scatter->sub, plus = scatter->plus;
    PIXEL_FUNCTION_DECLARE(f);

diff -ru8i src/gd_pixelate.c src.new/gd_pixelate.c
--- src/gd_pixelate.c   2011-05-14 13:38:26 +0800
+++ src.new/gd_pixelate.c   2011-06-17 10:25:34 +0800
@@ -1,11 +1,11 @@
 #include "gd.h"

-int gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode)
+BGD_DECLARE(int) gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode)
 {
    int x, y;

    if (block_size <= 0) {
        return 0;
    } else if (block_size == 1) {
        return 1;
    }

@imazen-bot
Copy link
Author

Thanks, confirmed and committed.


Originally posted by tabe (Takeshi Abe) on Jun 17 2011 via Bitbucket

@varsleak varsleak mentioned this issue Jan 19, 2017
Thinstation pushed a commit to Thinstation/thinstation that referenced this issue Sep 15, 2020
	deleted:    ts/ports/components/graphite/graphite#1.3.14-1.pkg.tar.xz
	modified:   ts/ports/components/texlive/.footprint
	modified:   ts/ports/components/texlive/Pkgfile
	modified:   ts/ports/components/texlive/texlive#2020.54586-5.pkg.tar.xz
	renamed:    ts/ports/components/graphite/.footprint -> ts/ports/contrib/graphite2/.footprint
	renamed:    ts/ports/components/graphite/.md5sum -> ts/ports/contrib/graphite2/.md5sum
	new file:   ts/ports/contrib/graphite2/Pkgfile
	new file:   ts/ports/contrib/graphite2/graphite2#1.3.14-1.pkg.tar.xz
	new file:   ts/ports/contrib/libgd/.footprint
	new file:   ts/ports/contrib/libgd/.md5sum
	new file:   ts/ports/contrib/libgd/Pkgfile
	new file:   ts/ports/contrib/libgd/libgd#2.3.0-1.pkg.tar.xz
	new file:   ts/ports/contrib/libpaper/.footprint
	new file:   ts/ports/contrib/libpaper/.md5sum
	new file:   ts/ports/contrib/libpaper/Pkgfile
	new file:   ts/ports/contrib/libpaper/libpaper#1.1.28-2.pkg.tar.xz
	deleted:    ts/ports/contrib/remmina/v1.3.6.tar.gz
	modified:   ts/ports/opt/harfbuzz/.footprint
	modified:   ts/ports/opt/harfbuzz/Pkgfile
	modified:   ts/ports/opt/harfbuzz/harfbuzz#2.6.2-1.pkg.tar.xz
sterlingpickens added a commit to sterlingpickens/libgd that referenced this issue Apr 30, 2021
vapier pushed a commit that referenced this issue Oct 9, 2021
Since #737 gdImageColorTransparent does not correctly handle the case that im->transparent = -1
(which is the initial value and used to indicate no transparent colour has been set).

This leads to undefined behaviour via an out-of-bound write:
im->alpha[im->transparent] = gdAlphaOpaque;
(in practice I assume this merely overwrites an earlier struct member)

This can be triggered via loading a gif through gdImageCreateFromGifPtr

third_party/gd/source/gd.c:922:2: runtime error: index -1 out of bounds for type 'int [256]'
    #0 0x5629c034a839 in gdImageColorTransparent third_party/gd/source/gd.c:922:29
    #1 0x5629c034ebf0 in gdImageCreateFromGifCtx third_party/gd/source/gd_gif_in.c:328:4
    #2 0x5629c034f14f in gdImageCreateFromGifPtr third_party/gd/source/gd_gif_in.c:186:7

Fixes #784.
pierrejoye pushed a commit that referenced this issue Jan 29, 2022
Since #737 gdImageColorTransparent does not correctly handle the case that im->transparent = -1
(which is the initial value and used to indicate no transparent colour has been set).

This leads to undefined behaviour via an out-of-bound write:
im->alpha[im->transparent] = gdAlphaOpaque;
(in practice I assume this merely overwrites an earlier struct member)

This can be triggered via loading a gif through gdImageCreateFromGifPtr

third_party/gd/source/gd.c:922:2: runtime error: index -1 out of bounds for type 'int [256]'
    #0 0x5629c034a839 in gdImageColorTransparent third_party/gd/source/gd.c:922:29
    #1 0x5629c034ebf0 in gdImageCreateFromGifCtx third_party/gd/source/gd_gif_in.c:328:4
    #2 0x5629c034f14f in gdImageCreateFromGifPtr third_party/gd/source/gd_gif_in.c:186:7

Fixes #784.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant