[php-maint] Bug#331001: php5-gd: error in gd/gd.c : bad variable
sizes for parse (cause data squish on 64 bits machines)
Pierre Habouzit
madcoder at debian.org
Sat Oct 1 00:22:39 UTC 2005
Package: php5-gd
Version: 5.0.5-1
Severity: important
Tags: patch
imagettftext is broken in php5-gd, but not in php4-gd on 64 machines
(amd64 here, but any machine where sizeof(long) != sizeof(int) is
affected).
running a diff between two version shows that interesting part in
ext/gd/gd.c :
@@ -3017,8 +3109,7 @@ static void php_imagettftext_common(INTE
{
zval *IM, *EXT = NULL;
gdImagePtr im=NULL;
- long col = -1, x = -1, y = -1;
- int str_len, fontname_len, i, brect[8];
+ int col = -1, x = -1, y = -1, str_len, fontname_len, i,
brect[8];
double ptsize, angle;
unsigned char *str = NULL, *fontname = NULL;
char *error = NULL;
and a bit after, you have a zend parse :
} else if (zend_parse_parameters(argc TSRMLS_CC, "rddlllss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
prototype for variables x, y, col is clearly the 'lll' part, meaning that x, y and col have to be longs, not ints.
this particular change has to be reverted since it breaks GD. On 64 bits machines, you have to run :
ImageTTFText($img, $font, $angle, $whatever_you_want, $x << 32 | $y, ...) to make it work ;p
problem is, ImageTTFText is quite important for GD, and having it broken, is painful.
Cheers,
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12
Locale: LANG=fr_FR at euro, LC_CTYPE=fr_FR at euro (charmap=ISO-8859-15)
Versions of packages php5-gd depends on:
ii debconf [debconf-2.0] 1.4.58 Debian configuration management sy
ii libapache2-mod-php5 [phpa 5.0.5-1 server-side, HTML-embedded scripti
ii libc6 2.3.5-6 GNU C Library: Shared libraries an
ii libfreetype6 2.1.10-1 FreeType 2 font engine, shared lib
ii libgd2-xpm 2.0.33-2 GD Graphics Library version 2
ii libjpeg62 6b-10 The Independent JPEG Group's JPEG
ii libpng12-0 1.2.8rel-4 PNG library - runtime
ii libt1-5 5.1.0-2 Type 1 font rasterizer library - r
ii libx11-6 6.8.2.dfsg.1-7 X Window System protocol client li
ii libxpm4 6.8.2.dfsg.1-7 X pixmap library
pi php5-cli [phpapi-20041030 5.0.5-1 command-line interpreter for the p
ii php5-common 5.0.5-1 Common files for packages built fr
ii xlibs 6.8.2.dfsg.1-7 X Window System client libraries m
ii zlib1g 1:1.2.3-4 compression library - runtime
php5-gd recommends no packages.
-- debconf information:
php5/remove_extension: true
php5/extension_gd_apache2: true
php5/add_extension: true
php5/extension_gd_cli: true
php5/extension_gd_cgi: true
More information about the pkg-php-maint
mailing list