mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-05 09:01:07 +00:00
Set errno to ENOMEM on overflow in sbrk (bug 18592)
This commit is contained in:
parent
6471190491
commit
c13e078308
@ -1,3 +1,8 @@
|
|||||||
|
2015-07-07 Cyril Hrubis <chrubis@suse.cz>
|
||||||
|
|
||||||
|
[BZ #18592]
|
||||||
|
* misc/sbrk.c: Set errno to ENOMEM on overflow.
|
||||||
|
|
||||||
2015-07-06 Wilco Dijkstra <wdijkstr@arm.com>
|
2015-07-06 Wilco Dijkstra <wdijkstr@arm.com>
|
||||||
|
|
||||||
* sysdeps/aarch64/fpu/math_private.h (__ieee754_sqrt):
|
* sysdeps/aarch64/fpu/math_private.h (__ieee754_sqrt):
|
||||||
|
@ -47,10 +47,15 @@ __sbrk (intptr_t increment)
|
|||||||
return __curbrk;
|
return __curbrk;
|
||||||
|
|
||||||
oldbrk = __curbrk;
|
oldbrk = __curbrk;
|
||||||
if ((increment > 0
|
if (increment > 0
|
||||||
? ((uintptr_t) oldbrk + (uintptr_t) increment < (uintptr_t) oldbrk)
|
? ((uintptr_t) oldbrk + (uintptr_t) increment < (uintptr_t) oldbrk)
|
||||||
: ((uintptr_t) oldbrk < (uintptr_t) -increment))
|
: ((uintptr_t) oldbrk < (uintptr_t) -increment))
|
||||||
|| __brk (oldbrk + increment) < 0)
|
{
|
||||||
|
__set_errno (ENOMEM);
|
||||||
|
return (void *) -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__brk (oldbrk + increment) < 0)
|
||||||
return (void *) -1;
|
return (void *) -1;
|
||||||
|
|
||||||
return oldbrk;
|
return oldbrk;
|
||||||
|
Loading…
Reference in New Issue
Block a user