1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00

Fixed incorrect heap corruptiuon detection code

This commit is contained in:
Dmitry Stogov
2006-11-13 10:28:46 +00:00
parent a27d73b13d
commit f00ee72c35
+9 -8
View File
@@ -666,6 +666,15 @@ static long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
p = ZEND_MM_NEXT_BLOCK(b);
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);
if (q <= p ||
(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");
}
}
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;
}
return leaks;