fix PTRDIFF_MAX check in the 32-bit mmap wrapper

It wasn't making use of the page-rounded size.

Change-Id: I911345fcfd6419a4dbc18a4622b42e1b76729abb
This commit is contained in:
Daniel Micay
2015-11-03 05:30:29 -05:00
parent e07558fb80
commit 706186d266

View File

@@ -48,7 +48,7 @@ void* mmap64(void* addr, size_t size, int prot, int flags, int fd, off64_t offse
// prevent allocations large enough for `end - start` to overflow
size_t rounded = BIONIC_ALIGN(size, PAGE_SIZE);
if (rounded < size || size > PTRDIFF_MAX) {
if (rounded < size || rounded > PTRDIFF_MAX) {
errno = ENOMEM;
return MAP_FAILED;
}