Skip to content

Commit

Permalink
check return value of proc_regionfilename(); this possibly addresses #…
Browse files Browse the repository at this point in the history
…514: [OSX] Process.memory_maps() segfault (critical!).D
  • Loading branch information
giampaolo committed Oct 5, 2016
1 parent f06f4a8 commit 833e70a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion HISTORY.rst
Expand Up @@ -14,6 +14,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues

**Bug fixes**

- #514: [OSX] possibly fix Process.memory_maps() segfault (critical!).
- #783: [OSX] Process.status() may erroneously return "running" for zombie
processes.
- #798: [Windows] Process.open_files() returns and empty list on Windows 10.
Expand All @@ -30,7 +31,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
- #908: [OSX, BSD] different process methods could errounesuly mask the real
error for high-privileged PIDs and raise NoSuchProcess and AccessDenied
instead of OSError and RuntimeError.
- #XXX: [OSX] Process open_files() and connections() methods may raise
- #909: [OSX] Process open_files() and connections() methods may raise
OSError with no exception set if process is gone.


Expand Down
5 changes: 5 additions & 0 deletions psutil/_psutil_osx.c
Expand Up @@ -346,6 +346,11 @@ psutil_proc_memory_maps(PyObject *self, PyObject *args) {
(info.max_protection & VM_PROT_EXECUTE) ? 'x' : '-');

err = proc_regionfilename(pid, address, buf, sizeof(buf));
if (err == 0) {
psutil_raise_for_pid(
pid, "proc_regionfilename() syscall failed");
goto error;
}

if (info.share_mode == SM_COW && info.ref_count == 1) {
// Treat single reference SM_COW as SM_PRIVATE
Expand Down

0 comments on commit 833e70a

Please sign in to comment.