Summary: | Bad check for mmap return value | ||
---|---|---|---|
Product: | [Frameworks and Libraries] kwayland | Reporter: | hanno |
Component: | client | Assignee: | Martin Flöser <mgraesslin> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | kde, kwin-bugs-null |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/frameworks/kwayland/commit/2adaa15a1c5911e95b4288e75b9a6229613152da | Version Fixed In: | |
Attachments: | proposed patch |
Well spotted A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kwayland/-/merge_requests/36 Git commit 2adaa15a1c5911e95b4288e75b9a6229613152da by David Edmundson, on behalf of Hanno Böck. Committed on 12/07/2021 at 11:29. Pushed by davidedmundson into branch 'master'. Fix check for mmap failure Docs for mmap state it returns -1 if it can't map an address rather than null. M +2 -2 src/client/shm_pool.cpp https://invent.kde.org/frameworks/kwayland/commit/2adaa15a1c5911e95b4288e75b9a6229613152da |
Created attachment 128670 [details] proposed patch In the file shm_pool.cpp there are 2 places where the return value of mmap() is checked in a way that it expects a zero on failure. However this is wrong, mmap returns MAP_FAILED (or -1) on error. Patch attached.