From 75e9e12093b9c2b2dfa6c75af839db6a73f71964 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 23 Aug 2006 20:22:31 +0000 Subject: [PATCH] - MFH: add support for entities in hexadecimal format, like © can be passed as © or © (sync with gd) --- NEWS | 2 ++ ext/gd/libgd/gdft.c | 28 ++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index eb31acff42c..aa758dccdfa 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Sep 2006, PHP 5.2.0 +- Added support for hexadecimal entity in imagettftext() for the bundled GD. + (Pierre) - Fixed bug #38543 (shutdown_executor() may segfault when memory_limit is too low). (Dmitry) - Fixed bug #38535 (memory corruption in pdo_pgsql driver on error retrieval diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index a09bdcba6d6..6603cd64c31 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -207,12 +207,28 @@ static int gdTcl_UtfToUniChar (char *str, Tcl_UniChar * chPtr) byte = *((unsigned char *) (str + 1)); if (byte == '#') { - for (i = 2; i < 8; i++) { - byte = *((unsigned char *) (str + i)); - if (byte >= '0' && byte <= '9') { - n = (n * 10) + (byte - '0'); - } else { - break; + byte = *((unsigned char *) (str + 2)); + if (byte == 'x' || byte == 'X') { + for (i = 3; i < 8; i++) { + byte = *((unsigned char *) (str + i)); + if (byte >= 'A' && byte <= 'F') + byte = byte - 'A' + 10; + else if (byte >= 'a' && byte <= 'f') + byte = byte - 'a' + 10; + else if (byte >= '0' && byte <= '9') + byte = byte - '0'; + else + break; + n = (n * 16) + byte; + } + } else { + for (i = 2; i < 8; i++) { + byte = *((unsigned char *) (str + i)); + if (byte >= '0' && byte <= '9') { + n = (n * 10) + (byte - '0'); + } else { + break; + } } } if (byte == ';') {