Add overflow checks to libgomp memory allocation functions
libgomp's aligned memory allocation functions now include overflow checks to prevent potential vulnerabilities.
GCC’s libgomp library has been updated to include overflow checks in its aligned memory allocation functions, gomp_aligned_alloc and omp_aligned_alloc. This addresses potential vulnerabilities, particularly on platforms like MinGW where _aligned_alloc might not perform its own overflow checking, ensuring safer memory management.
In Details
This commit enhances overflow checking in alloc.c for gomp_aligned_alloc. While omp_aligned* functions are presumed to handle overflows, gomp_aligned_alloc relies on libc or its own checks. The patch adds overflow checks for the _aligned_malloc case and the final fallback allocation, especially relevant for platforms like MinGW where _aligned_alloc lacks these checks.
- libgomp
- The GNU implementation of OpenMP runtime library, providing support for parallel programming.
- aligned memory allocation
- Allocating memory that is aligned to a specific boundary, which can improve performance for certain operations, especially SIMD instructions.
- overflow check
- Verifying that arithmetic operations do not exceed the maximum representable value for a data type, preventing unexpected behavior or security vulnerabilities.
- MINIMEW
- A free software development environment which includes a Windows port of the GNU Compiler Collection (GCC) and GNU Debugger (GDB).