summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2001-04-30 05:39:37 +0000
committerAndi Gutmans <andi@php.net>2001-04-30 05:39:37 +0000
commitaa1c46b3d8707f6a69d067ae74c0597980543f6f (patch)
tree686ce408aabe772b04fadf33aa7f7cdcd742b756 /Zend
parentce7d0ef0904bf514946656b5a3133bda5d6cce27 (diff)
downloadphp-git-aa1c46b3d8707f6a69d067ae74c0597980543f6f.tar.gz
- Try to solve crash on OS400. There is actually no reason I can see for
why his fix should solve a crash but it doesn't harm.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_alloc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index ec09b958d2..ade2d03c31 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -253,8 +253,8 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_mem_header *p = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-MEM_HEADER_PADDING);
- zend_mem_header *orig = p;
+ zend_mem_header *p;
+ zend_mem_header *orig;
DECLARE_CACHE_VARS();
ALS_FETCH();
@@ -262,6 +262,8 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
return _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
+ p = orig = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-MEM_HEADER_PADDING);
+
#if defined(ZTS) && ZEND_DEBUG
if (p->thread_id != tsrm_thread_id()) {
void *new_p;
@@ -614,8 +616,7 @@ ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_
memcpy(&end_magic, (((char *) p)+sizeof(zend_mem_header)+MEM_HEADER_PADDING+p->size), sizeof(long));
if (valid_beginning && (end_magic != MEM_BLOCK_END_MAGIC)) {
- long magic_num = MEM_BLOCK_END_MAGIC;
- char *overflow_ptr, *magic_ptr=(char *) &magic_num;
+ char *overflow_ptr, *magic_ptr=(char *) &mem_block_end_magic;
int overflows=0;
int i;
@@ -623,7 +624,7 @@ ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_
return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
had_problems = 1;
- overflow_ptr = &end_magic;
+ overflow_ptr = (char *) &end_magic;
for (i=0; i<sizeof(long); i++) {
if (overflow_ptr[i]!=magic_ptr[i]) {