]> granicus.if.org Git - php/commit
Allocate zend_strings with correct size
authorNikita Popov <nikic@php.net>
Wed, 23 Apr 2014 17:05:16 +0000 (19:05 +0200)
committerNikita Popov <nikic@php.net>
Wed, 23 Apr 2014 17:34:51 +0000 (19:34 +0200)
commit08ae88157b4f73154b2f1ffe72c3957edb3772fc
treeb4c1ae6e553379588d5b214d01297d476de3e4a7
parent20580a511c029582fd2be6c8efbed40c89f7a874
Allocate zend_strings with correct size

For me (32bit) sizeof(zend_string) is 20, which means that the
char[1] array at the end is padded with three bytes. Thus allocating
based on sizeof(zend_string)-1 overallocates by those 3 padding bytes.

This commit fixes the allocation size, by using XtOffsetOf.
Zend/zend.h
Zend/zend_ini.h
Zend/zend_string.h
ext/opcache/ZendAccelerator.c
ext/opcache/zend_persist.c
ext/opcache/zend_persist_calc.c
ext/standard/php_smart_str.h
ext/standard/tests/strings/str_pad_variation5.phpt