php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #225 'Unintended Feature' in ImageSetPixel()
Submitted: 1998-03-31 20:37 UTC Modified: 1998-04-01 00:12 UTC
From: ecain at Phosphor dot net Assigned: rasmus (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 3.0 Release Candidate 3 OS: Linux AXP 2.1.92
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ecain at Phosphor dot net
New email:
PHP Version: OS:

 

 [1998-03-31 20:37 UTC] ecain at Phosphor dot net
Found a small bug in ImageSetPixel in functions/gd.c. See below.
It seems that this bug has been here for awhile. (Found it in php3.0b3 too)

void php3_imagesetpixel(INTERNAL_FUNCTION_PARAMETERS) {
        YYSTYPE *imarg, *xarg, *yarg, *colarg;
        gdImagePtr im;
        int col, y, x;
        int ind_type;
        GD_TLS_VARS;

        if (ARG_COUNT(ht) != 4 ||
                getParameters(ht, 4, &imarg, &xarg, &yarg, &colarg) == FAILURE)
        {
                WRONG_PARAM_COUNT;
        }

        convert_to_long(imarg);
        convert_to_long(xarg);
        convert_to_long(yarg);
        convert_to_long(colarg);

        col = colarg->value.lval;
        y = yarg->value.lval;
        x = yarg->value.lval;
/*          ^
 * In this function x and y are always == to what the user
 * entered for yarg (as you can see)
 *
 * It should be:
 *      x = xarg->value.lval;
 *********************************************************/

        im = php3_list_find(imarg->value.lval, &ind_type);
        if(!im || ind_type != GD_GLOBAL(le_gd)) {
                php3_error(E_WARNING, "Unable to find image pointer");
                RETURN_FALSE;
        }

        gdImageSetPixel(im,x,y,col);

        RETURN_TRUE;
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-01 00:12 UTC] rasmus
Thanks for catching that.  It has been fixed in the source tree now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC