mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Fixed incorrect heap corruptiuon detection code
This commit is contained in:
parent
d20ceab08d
commit
eae5ec4197
1 changed files with 9 additions and 8 deletions
|
@ -666,6 +666,15 @@ static long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
|
||||||
|
|
||||||
p = ZEND_MM_NEXT_BLOCK(b);
|
p = ZEND_MM_NEXT_BLOCK(b);
|
||||||
while (1) {
|
while (1) {
|
||||||
|
if (ZEND_MM_IS_GUARD_BLOCK(p)) {
|
||||||
|
ZEND_MM_CHECK_MAGIC(p, MEM_BLOCK_GUARD);
|
||||||
|
segment = segment->next_segment;
|
||||||
|
if (!segment) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
p = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
q = ZEND_MM_NEXT_BLOCK(p);
|
q = ZEND_MM_NEXT_BLOCK(p);
|
||||||
if (q <= p ||
|
if (q <= p ||
|
||||||
(char*)q > (char*)segment + segment->size ||
|
(char*)q > (char*)segment + segment->size ||
|
||||||
|
@ -686,14 +695,6 @@ static long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
|
||||||
zend_mm_panic("zend_mm_heap corrupted");
|
zend_mm_panic("zend_mm_heap corrupted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ZEND_MM_IS_GUARD_BLOCK(q)) {
|
|
||||||
ZEND_MM_CHECK_MAGIC(q, MEM_BLOCK_GUARD);
|
|
||||||
segment = segment->next_segment;
|
|
||||||
if (!segment) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
q = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
|
|
||||||
}
|
|
||||||
p = q;
|
p = q;
|
||||||
}
|
}
|
||||||
return leaks;
|
return leaks;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue