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

Commit 620318fb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "C2SurfaceSyncObj: prevent OOB read in Import" into tm-qpr-dev

parents c0ef8df2 ce7a4768
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -64,6 +64,11 @@ std::shared_ptr<C2SurfaceSyncMemory> C2SurfaceSyncMemory::Import(
    }

    HandleSyncMem *o = static_cast<HandleSyncMem*>(handle);
    if (o->size() < sizeof(C2SyncVariables)) {
        android_errorWriteLog(0x534e4554, "240140929");
        return nullptr;
    }

    void *ptr = mmap(NULL, o->size(), PROT_READ | PROT_WRITE, MAP_SHARED, o->memFd(), 0);

    if (ptr == MAP_FAILED) {