Skip to content

v3.2.0

Choose a tag to compare

@JeanExtreme002 JeanExtreme002 released this 11 Oct 21:30
0a8f701

What's changed

A second review of the project, platform by platform. The biggest find was on Windows: since v2.0, scanning a 32-bit process from 64-bit Python failed every time. Alongside it came a thread-port leak on macOS, a Linux backend that could write into a different process after the target's pid was reused, and pattern scans that missed overlapping matches. All of it is fixed here, each with a test — including a real 32-bit child process on the Windows CI runners. The release also adds Python 3.14 and 3.15 to the supported and tested versions.

Fixed

  • Windows: 32-bit (WOW64) targets work again. A 64-bit Python handed VirtualQueryEx the 28-byte 32-bit MEMORY_BASIC_INFORMATION for a WOW64 target. The kernel only fills the caller's native layout and rejects a smaller buffer, so the region walk hit its failure cap and every scan of a 32-bit process raised. The walk now always uses the host's native struct (#108)
  • Windows: non-ASCII process and module names. The ANSI Toolhelp32 structs were decoded as UTF-8, so a name with accents came back garbled and OpenProcess(name=...) missed it. The backend uses the wide (W) API now: process names are exact, and module names are exact for characters in the system's ANSI code page (Toolhelp32 itself builds module entries from ANSI data) (#108)
  • macOS: get_threads() no longer leaks thread port rights. It freed the array task_threads returns but never the send rights inside it, so every call leaked one reference per thread — unbounded for anything polling the thread list. The Mach region structs are also packed to match the kernel headers, and loop bounds read from the target's memory are capped (#108)
  • macOS: writes to protected pages restore the right protection. The temporary elevation dropped EXECUTE, and a write crossing into a neighbouring region restored the first region's protection over both. EXECUTE is kept where the kernel allows it, and each region gets its own protection back (#108)
  • Linux: a reused pid is never written to. The backend addressed the target by pid on every call, so after the target exited, a process that inherited the pid received the writes. Objects now bind to the original process with a pidfd (or its start time where pidfds are unavailable) and raise ProcessIDNotExistsError once it is gone (#108)
  • Pattern scans find overlapping matches. 90 90 over 90 90 90 returned one match where the exact-value scan returned two. Fixed-width patterns — every IDA-style signature — report overlapping matches now; variable-width regexes keep non-overlapping semantics (#108)
  • search_by_addresses is faster and finds more. It read the whole chunk (up to 256 MiB) around each requested address; it now reads windows around the addresses — 20–150x faster on sparse result sets — and reads a value that runs into an adjacent readable region instead of reporting None. Programming errors and MemoryError propagate instead of turning into None (#108)
  • MCP: close and shutdown no longer hang. A pointer scan held the session lock for its whole walk and closing waited on it forever. Closing waits at most 5 seconds and leaves the handle to the running call, which stops at its next check — the pointer walk and the refine now have one. open_process no longer blocks the server's other requests while it attaches, and scan descriptions stay bounded across long refine chains (#108)
  • App: changing process no longer closes the old handle while a stalled worker may still be using it; the pointer scan's Stop button also ends the path search; the Memory Map on Windows no longer frees regions the app did not allocate (#108)

Changed

  • Ordered comparisons of bytes are lexicographic. BIGGER_THAN, SMALLER_THAN and VALUE_BETWEEN on bytes followed the host byte order, while str — and the app's refine step — compared lexicographically, so a first scan and its refine could disagree. bytes now compares like str; compare raw numbers of any width as int (#108)
  • Windows: free_memory refuses memory the object did not allocate unless size= is passed, as macOS already did. It used to release any address, including the target's own heap segments and thread stacks (#108)
  • macOS: ThreadInfo.tid is the system-wide thread id (what pthread_threadid_np returns) instead of the Mach port name: stable across calls, and main_thread is the real main thread (#108)
  • MCP: an ambiguous process name hides the candidates the policy denies (reported as hidden_by_policy) and selects the one that remains; the server's write-confirmation wording no longer claims that every client asks before a write (#108)

Added

  • Python 3.14 and 3.15 in the classifiers and the test matrix (Ubuntu and Windows). 3.15 is tested against its release candidate until 3.15.0 is out (#110)
  • should_stop on scan_pointer_paths: a callable polled during the path search, so a deadline or a cancel button can end a search that runs a long time between two results (#108)
  • CI builds the documentation with warnings as errors, and the GitHub Actions used by the workflows are on their current major versions (#108, #107)

Install

pip install --upgrade PyMemoryEditor

📖 Full documentation: pymemoryeditor.readthedocs.io · MCP guide: pymemoryeditor.readthedocs.io/en/latest/mcp.html

Full Changelog: v3.1.0...v3.2.0