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

Commit 31096297 authored by Andreas Huber's avatar Andreas Huber
Browse files

If nothing is to be copied, return right away.

This avoids a potential out-of-bounds problem in the code below.

Change-Id: I942d55da0a5288b37512cb74407f900a2d824c0c
related-to-bug: 4139974
parent 39068e0f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -135,6 +135,10 @@ size_t PageCache::releaseFromStart(size_t maxBytes) {
void PageCache::copy(size_t from, void *data, size_t size) {
    LOGV("copy from %d size %d", from, size);

    if (size == 0) {
        return;
    }

    CHECK_LE(from + size, mTotalSize);

    size_t offset = 0;