Skip to content

Commit 88b82ae

Browse files
committed
Merge branch 'strtr_wu94_54' into strtr_wu94_55
2 parents 70b25e9 + 930ef9d commit 88b82ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,7 +2965,7 @@ static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum,
29652965
res->shift->table_mask = SHIFT_TAB_SIZE - 1;
29662966
php_strtr_populate_shift(patterns, patnum, B, res->m, res->shift);
29672967

2968-
res->hash = safe_emalloc(HASH_TAB_SIZE, sizeof(*res->hash->entries), sizeof(*res->shift));
2968+
res->hash = safe_emalloc(HASH_TAB_SIZE, sizeof(*res->hash->entries), sizeof(*res->hash));
29692969
res->hash->table_mask = HASH_TAB_SIZE - 1;
29702970

29712971
res->patterns = safe_emalloc(patnum, sizeof(*res->patterns), 0);
@@ -3001,7 +3001,7 @@ static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum,
30013001
}
30023002
}
30033003
}
3004-
res->hash->entries[HASH_TAB_SIZE] = patnum;
3004+
res->hash->entries[HASH_TAB_SIZE] = patnum; /* OK, we effectively allocated SIZE+1 */
30053005
for (i = HASH_TAB_SIZE - 1; i >= 0; i--) {
30063006
if (res->hash->entries[i] == -1) {
30073007
res->hash->entries[i] = res->hash->entries[i + 1];

0 commit comments

Comments
 (0)