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

Commit 84dcff4c 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: cf911513

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

Change-Id: Idb480f2a4dc1aa0d929e17e7e568a9c1b05c8489
parents 9be245c3 cf911513
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;