Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf6c14c8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fail explicitly on length overflow." into oc-dev am: ea8d38e7 am:...

Merge "Fail explicitly on length overflow." into oc-dev am: ea8d38e7 am: cf911513 am: 84dcff4c

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619803

Change-Id: Ie7b7a57f55ead23f8d382ac98eb5087a2c614b1b
parents 64fb5012 84dcff4c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -190,6 +190,10 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le
    adjust = offset % mPageSize;
    adjOffset = offset - adjust;
    adjLength = length + adjust;
    if (__builtin_add_overflow(length, adjust, &adjLength)) {
        ALOGE("adjusted length overflow: length %zu adjust %d", length, adjust);
        return false;
    }

    flags = MAP_SHARED;
    prot = PROT_READ;