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

Commit 874a15bf authored by Dan Stoza's avatar Dan Stoza Committed by android-build-merger
Browse files

Merge "Region: Speculative fix for ubsan abort" into pi-dev am: ab2e344e

am: c0b93656

Change-Id: Ib32aa1f6c3dd371ec7f3011d7a10ed20577d123f
parents f0820abf c0b93656
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -838,6 +838,11 @@ Region::const_iterator Region::begin() const {
}

Region::const_iterator Region::end() const {
    // Workaround for b/77643177
    // mStorage should never be empty, but somehow it is and it's causing
    // an abort in ubsan
    if (mStorage.isEmpty()) return mStorage.array();

    size_t numRects = isRect() ? 1 : mStorage.size() - 1;
    return mStorage.array() + numRects;
}