mirror of
				https://sourceware.org/git/glibc.git
				synced 2025-11-03 20:53:13 +03:00 
			
		
		
		
	malloc: Use INT_ADD_OVERFLOW instead of __builtin_add_overflow_p
clang does not support the __builtin_*_overflow_p builtins, on gcc the macros will call __builtin_*_overflow_p. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
This commit is contained in:
		@@ -224,6 +224,7 @@
 | 
			
		||||
#include <stdio.h>    /* needed for malloc_stats */
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <intprops.h>
 | 
			
		||||
 | 
			
		||||
#include <shlib-compat.h>
 | 
			
		||||
 | 
			
		||||
@@ -3526,8 +3527,8 @@ __libc_free (void *mem)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  /* Check size >= MINSIZE and p + size does not overflow.  */
 | 
			
		||||
  if (__glibc_unlikely (__builtin_add_overflow_p ((uintptr_t) p, size - MINSIZE,
 | 
			
		||||
						  (uintptr_t) 0)))
 | 
			
		||||
  if (__glibc_unlikely (INT_ADD_OVERFLOW ((uintptr_t) p,
 | 
			
		||||
					  size - MINSIZE)))
 | 
			
		||||
    return malloc_printerr_tail ("free(): invalid size");
 | 
			
		||||
 | 
			
		||||
  _int_free_chunk (arena_for_chunk (p), p, size, 0);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user