Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Maintenance:2020
glibc.openSUSE_12.3_Update
malloc-overflow.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File malloc-overflow.patch of Package glibc.openSUSE_12.3_Update
libc:b73ed247781d533628b681f57257dc85882645d3 libc:55e17aadc1ef17a1df9626fb0e9fba290ece3331 libc:1159a193696ad48ec86e5895f6dee3e539619c0e 2013-09-11 Will Newton <will.newton@linaro.org> [BZ #15857] * malloc/malloc.c (__libc_memalign): Check the value of bytes does not overflow. [BZ #15856] * malloc/malloc.c (__libc_valloc): Check the value of bytes does not overflow. [BZ #15855] * malloc/malloc.c (__libc_pvalloc): Check the value of bytes does not overflow. Index: glibc-2.17/malloc/malloc.c =================================================================== --- glibc-2.17.orig/malloc/malloc.c +++ glibc-2.17/malloc/malloc.c @@ -3020,6 +3020,13 @@ __libc_memalign(size_t alignment, size_t /* Otherwise, ensure that it is at least a minimum chunk size */ if (alignment < MINSIZE) alignment = MINSIZE; + /* Check for overflow. */ + if (bytes > SIZE_MAX - alignment - MINSIZE) + { + __set_errno (ENOMEM); + return 0; + } + arena_get(ar_ptr, bytes + alignment + MINSIZE); if(!ar_ptr) return 0; @@ -3051,6 +3058,13 @@ __libc_valloc(size_t bytes) size_t pagesz = GLRO(dl_pagesize); + /* Check for overflow. */ + if (bytes > SIZE_MAX - pagesz - MINSIZE) + { + __set_errno (ENOMEM); + return 0; + } + __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, const __malloc_ptr_t)) = force_reg (__memalign_hook); @@ -3088,6 +3102,13 @@ __libc_pvalloc(size_t bytes) size_t page_mask = GLRO(dl_pagesize) - 1; size_t rounded_bytes = (bytes + page_mask) & ~(page_mask); + /* Check for overflow. */ + if (bytes > SIZE_MAX - 2*pagesz - MINSIZE) + { + __set_errno (ENOMEM); + return 0; + } + __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, const __malloc_ptr_t)) = force_reg (__memalign_hook);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor