Repository navigation
v3.1.0
What's changed
A full review of the project, from the ctypes backends up to the MCP server and the app. Most of what it found was in the error paths the test suite never walked: a region walk that could not end, a scan that disagreed with its own refine, a dead target reported as an empty result. All of it is fixed here, the suite now covers those paths (including a real child process), and the scan gained the aligned switch so the one behaviour that had to change by default stays available.
Fixed
- Scan and refine agree on which addresses exist. The EXACT scan used
bytes.findand reported anintat any byte offset, while the ordered scans (greater than, between) and the NumPy path only looked at offsets aligned to the value's width. Searching the 4-byte int1over00 01 00 00 | 00 00 00 00 | 01 00 00 00gave[1, 8]for EXACT,[0, 8]forBIGGER_THAN_OR_EXACTand nothing for NOT_EXACT, so a refine could drop an address the first scan had just reported. Numeric scans at a natural width (1, 2, 4, 8 bytes) are now aligned in every kernel,floatcompares by IEEE-754 value (-0.0 == 0.0, NaN never matches), andbytesis byte-granular everywhere likestr. A Hypothesis property pinsEXACT == ordered-EXACT,EXACT ⊆ ≥andEXACT ⊔ NOT_EXACT == all slots(#105) - Region enumeration on Windows and macOS could not end. Both walkers treated every non-terminal error as "skip one page and carry on", with no cap, so a target that exited mid-walk or a handle without query rights spun across the whole address space. The walk now stops after 64 consecutive failures or on a dead handle/task and raises
ProcessIDNotExistsError,PermissionErrororOSError, as the contract always said it did. On Windows,_read_regionalso readsGetLastErrornow: an access-denied or dead-target scan raises instead of silently coming back empty, as it already did on Linux and macOS (#105) - A target that exits mid-scan is reported, not swallowed.
scan_pointer_paths,rescan_pointer_pathsand the pointer-map builder caught every exception, so a dead or closed process produced an empty map indistinguishable from "no pointers found". They now check whether the target is still alive before writing a failure off as a vanished page; Windows asks the handle itself, since an open handle keeps the pid reserved. An emptystr/bytessearch target, which matched every offset including one past the end, raisesValueError;bytesmatches straddling a chunk boundary are no longer lost (#105) - Linux error hints point at the right knob. A
PermissionErroropening/proc/<pid>/mapsblamedptrace_scope, which does not gate that file; the EPERM fromprocess_vm_readv/process_vm_writev, whichptrace_scopedoes gate, carried no hint. Each now names its actual cause, and a write to a read-only page says so instead of a bareEFAULT— Linux does not elevate page protection the way Windows and macOS do, whichplatform-notesnow documents (#105) - MCP: the server will not open itself, its client, or a recycled pid. Nothing stopped a model from opening the MCP server's own process (which holds the policy) or the client that launched it; both are refused now, and no flag lifts that. Approval is by name but the attach is by pid, and the user may spend minutes on the approval prompt:
attachre-reads the pid's name once it holds the handle and refuses it if the pid was reused. The denylist coversssh-agent,gpg-agent, keyrings and password managers, the Linux 15-charactercommtruncation applies to the allowlist as well as the denylist, NaN/Inf floats serialise as strings instead of invalid JSON, and unreadable rows inlist_scan_resultsare flagged rather than dropped (#105) - App: a dead target stays locked, and big refines are fast. After the target exited, the scan worker's cleanup re-enabled the controls and the cheat-table poller kept hitting the dead process ten times a second. Removing result rows was quadratic — one Qt signal and one mid-list
popper row — so dropping 150k of 200k rows took 2.3 s and a million-row refine did not finish; rows are removed per contiguous run now (0.29 s for the same case). Slot exceptions reach a dialog instead of vanishing on stderr, bulk edits go through the write worker like single edits, and the context menu no longer emitsNonefor a row a refine removed under it (#105) search_by_value(int, 100)now says that the 100 landed inbufflengthand suggestsvalue=100; an over-longstrwrite names the width instead of ctypes' "byte string too long"; a malformed pointer-path file gets aValueErrornaming the file and field instead of a bareKeyError(#105)
Added
aligned=Falseonsearch_by_valueandsearch_by_value_between(and the MCPscan_valuetool) steps numeric values byte by byte, for a value in a packed struct or inside a byte buffer. The typed fast path keeps its speed by running once per byte phase and merging the phases in order. The default,aligned=True, is the aligned behaviour described above;str,bytesand unusual widths (3, 5, 6, 7 bytes) are byte-granular either way (#105)--allow-remote-writefor the MCP server. Thesseandstreamable-httptransports have no authentication, so a writable server now refuses to start on them unless this flag is passed explicitly (#105)- A child-process integration test: spawns a Python process, reads and writes its memory, has it echo the written value, kills it and checks the errors. The first test in the suite that attaches to anything but itself (#105)
Changed
- Linux
get_threadsraisesPermissionErroron a denied listing instead of yielding nothing, matching macOS;WindowsProcess.close()logs a failedCloseHandleinstead of raising and gained the same__del__safety net as the macOS backend (#105) - App: Memory Map is
Ctrl+Rand Hex Viewer isCtrl+Shift+H— the oldCtrl+M/Ctrl+Hare Minimize and Hide on macOS. Closing with a populated cheat table asks first; an import whose entry is wider than the 1 MiB cap is reported and skipped instead of silently resized; addresses with a sign or underscores are rejected (#105) - Tooling: the mypy verdict no longer depends on which PySide6 stubs pip resolves, actions are pinned by SHA with Dependabot grouped monthly for them, every job has a timeout,
pip-auditruns weekly, and the release workflow checks the tag against__version__, runstwine checkand verifies themcp-publisherchecksum before uploading. Coverage floors are 62 (library) and 85 (MCP) (#105)
Install
pip install --upgrade PyMemoryEditor📖 Full documentation: pymemoryeditor.readthedocs.io · MCP guide: pymemoryeditor.readthedocs.io/en/latest/mcp.html
Full Changelog: v3.0.2...v3.1.0