summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2014-08-19 13:17:56 -0700
committerSara Golemon <pollita@php.net>2014-08-19 13:17:56 -0700
commitac4569621dc8762862dca6d39adf4ceb39e7e00b (patch)
tree80156e551ecaa966410095321693a9913e56259d
parentb278be894fcd0f2cbaee93e3f657f7f9beeb532f (diff)
parentcbe1597b747474388912c91018b0e12275784720 (diff)
downloadphp-git-ac4569621dc8762862dca6d39adf4ceb39e7e00b.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Switch use of strtok() to gd_strtok_r() Conflicts: NEWS
-rw-r--r--NEWS3
-rw-r--r--ext/gd/libgd/gdft.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 8cc7eb0c35..37d7de85dc 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,9 @@ PHP NEWS
. Fixed bug #67109 (First uppercase letter breaks date string parsing).
(Derick)
+- GD
+ . Made fontFetch's path parser thread-safe. (Sara).
+
?? ??? 2014, PHP 5.5.16
- COM:
diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c
index ac2bf344ff..884a4148fe 100644
--- a/ext/gd/libgd/gdft.c
+++ b/ext/gd/libgd/gdft.c
@@ -370,9 +370,10 @@ static void *fontFetch (char **error, void *key)
fontlist = gdEstrdup(a->fontlist);
/*
- * Must use gd_strtok_r else pointer corrupted by strtok in nested loop.
+ * Must use gd_strtok_r becasuse strtok() isn't thread safe
*/
for (name = gd_strtok_r (fontlist, LISTSEPARATOR, &strtok_ptr); name; name = gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) {
+ char *strtok_ptr_path;
/* make a fresh copy each time - strtok corrupts it. */
path = gdEstrdup (fontsearchpath);
@@ -388,7 +389,8 @@ static void *fontFetch (char **error, void *key)
break;
}
}
- for (dir = strtok (path, PATHSEPARATOR); dir; dir = strtok (0, PATHSEPARATOR)) {
+ for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
+ dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
if (!strcmp(dir, ".")) {
TSRMLS_FETCH();
#if HAVE_GETCWD