summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Lopes <gustavo@icemobile.com>2013-01-15 17:25:59 +0100
committerGustavo Lopes <gustavo@icemobile.com>2013-01-15 17:25:59 +0100
commit930ef9ddd663dcda5726b5d33c54c49a2f4f97d6 (patch)
tree40d826c76e751bdf0d1345045b4ce4645500cd23
parentd7bac4f5ba17c6fba00943a8bada49a4735a15a6 (diff)
downloadphp-git-930ef9ddd663dcda5726b5d33c54c49a2f4f97d6.tar.gz
Fixed inconsequential bug in strtr()
-rw-r--r--ext/standard/string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 953dfd17fb..58b5483651 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3021,7 +3021,7 @@ static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum,
res->shift->table_mask = SHIFT_TAB_SIZE - 1;
php_strtr_populate_shift(patterns, patnum, B, res->m, res->shift);
- res->hash = safe_emalloc(HASH_TAB_SIZE, sizeof(*res->hash->entries), sizeof(*res->shift));
+ res->hash = safe_emalloc(HASH_TAB_SIZE, sizeof(*res->hash->entries), sizeof(*res->hash));
res->hash->table_mask = HASH_TAB_SIZE - 1;
res->patterns = safe_emalloc(patnum, sizeof(*res->patterns), 0);
@@ -3051,7 +3051,7 @@ static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum,
}
}
}
- res->hash->entries[HASH_TAB_SIZE] = patnum;
+ res->hash->entries[HASH_TAB_SIZE] = patnum; /* OK, we effectively allocated SIZE+1 */
for (i = HASH_TAB_SIZE - 1; i >= 0; i--) {
if (res->hash->entries[i] == -1) {
res->hash->entries[i] = res->hash->entries[i + 1];