|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-12-31 05:34 UTC] anderson at metrolink dot com
[2005-03-30 09:02 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 04:00:01 2025 UTC |
The function dechex() can be passed a negative number, which will create a negative index into a static array. This was discoverd when trying to manipulate IP addresses represented by integers. Any IP that has a first octet >127 will cause this to happen. Since integers are signed, I wonder what other areas might have a similar problem when trying to manipulate IP addresses in this way. Simple Example: print(dechex(-333333)); This fix seems to correct this instance of the problem, but I fear that there could possibly be undesirable side effect of doing this. *** php-3.0.12/functions/math.c Thu Apr 22 09:19:50 1999 --- php/functions/math.c Tue Dec 28 21:16:08 1999 *************** *** 424,430 **** static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; char *result, *ptr, *ret; int len, digit; ! long value; if (arg->type != IS_LONG || base < 2 || base > 36) { return empty_string; --- 424,430 ---- static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; char *result, *ptr, *ret; int len, digit; ! unsigned long value; if (arg->type != IS_LONG || base < 2 || base > 36) { return empty_string;