Bug 421868 - Bad check for mmap return value
Summary: Bad check for mmap return value
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kwayland
Classification: Frameworks and Libraries
Component: client (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Martin Flöser
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-21 16:36 UTC by hanno
Modified: 2021-07-12 11:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
proposed patch (949 bytes, patch)
2020-05-21 16:36 UTC, hanno
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hanno 2020-05-21 16:36:57 UTC
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.
Comment 1 David Edmundson 2020-05-21 17:32:30 UTC
Well spotted
Comment 2 Bug Janitor Service 2021-07-12 09:41:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kwayland/-/merge_requests/36
Comment 3 David Edmundson 2021-07-12 11:29:55 UTC
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