@@ -1263,30 +1263,41 @@ static void *zend_mm_alloc_pages(zend_mm_heap *heap, uint32_t pages_count ZEND_F
12631263
12641264found :
12651265 if (steps > 2 && pages_count < 8 ) {
1266+ #ifdef __SANITIZE_ADDRESS__
1267+ /* ifdef needed to avoid unused var warnings for the following vars */
12661268 zend_mm_chunk * prev_chunk = chunk -> prev ;
12671269 zend_mm_chunk * next_chunk = chunk -> next ;
12681270 ZEND_MM_UNPOISON_CHUNK_HDR (next_chunk );
12691271 ZEND_MM_UNPOISON_CHUNK_HDR (prev_chunk );
1270- ZEND_MM_CHECK (next_chunk -> prev == chunk , "zend_mm_heap corrupted" );
1271- ZEND_MM_CHECK (prev_chunk -> next == chunk , "zend_mm_heap corrupted" );
1272+ #endif
1273+
1274+ ZEND_MM_CHECK (chunk -> next -> prev == chunk , "zend_mm_heap corrupted" );
1275+ ZEND_MM_CHECK (chunk -> prev -> next == chunk , "zend_mm_heap corrupted" );
12721276
12731277 /* move chunk into the head of the linked-list */
12741278 chunk -> prev -> next = chunk -> next ;
12751279 chunk -> next -> prev = chunk -> prev ;
12761280
1281+
1282+ #ifdef __SANITIZE_ADDRESS__
12771283 zend_mm_chunk * main_chunk = heap -> main_chunk ;
12781284 zend_mm_chunk * main_next_chunk = heap -> main_chunk -> next ;
12791285 ZEND_MM_UNPOISON_CHUNK_HDR (main_chunk );
12801286 ZEND_MM_UNPOISON_CHUNK_HDR (main_next_chunk );
1287+ #endif
12811288 chunk -> next = heap -> main_chunk -> next ;
12821289 chunk -> prev = heap -> main_chunk ;
12831290 chunk -> prev -> next = chunk ;
12841291 chunk -> next -> prev = chunk ;
1292+ #ifdef __SANITIZE_ADDRESS__
12851293 ZEND_MM_POISON_CHUNK_HDR (main_chunk , heap );
12861294 ZEND_MM_POISON_CHUNK_HDR (main_next_chunk , heap );
1295+ #endif
12871296
1297+ #ifdef __SANITIZE_ADDRESS__
12881298 ZEND_MM_POISON_CHUNK_HDR (next_chunk , heap );
12891299 ZEND_MM_POISON_CHUNK_HDR (prev_chunk , heap );
1300+ #endif
12901301 ZEND_MM_UNPOISON_CHUNK_HDR (chunk );
12911302 }
12921303 /* mark run as allocated */
0 commit comments