Merge changes I73a39c6d,Iab2af242
* changes: Fix test build break. extend the PTRDIFF_MAX size check to mremap
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@@ -26,12 +26,24 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "private/bionic_macros.h"
|
||||
|
||||
extern "C" void* ___mremap(void*, size_t, size_t, int, void*);
|
||||
|
||||
void* mremap(void* old_address, size_t old_size, size_t new_size, int flags, ...) {
|
||||
// prevent allocations large enough for `end - start` to overflow
|
||||
size_t rounded = BIONIC_ALIGN(new_size, PAGE_SIZE);
|
||||
if (rounded < new_size || rounded > PTRDIFF_MAX) {
|
||||
errno = ENOMEM;
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
void* new_address = nullptr;
|
||||
// The optional argument is only valid if the MREMAP_FIXED flag is set,
|
||||
// so we assume it's not present otherwise.
|
||||
|
Reference in New Issue
Block a user