Skip to content

Fix script buffer leaks in coremini_load - #260

Merged
drebbe-intrepid merged 2 commits into
masterfrom
codex/fix-247-script-buffer
Sep 16, 2026
Merged

drebbe-intrepid merged 2 commits into
masterfrom
codex/fix-247-script-buffer

Conversation

@drebbe-intrepid

@drebbe-intrepid drebbe-intrepid commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Repeated coremini_load calls retained the entire script allocation, including on native failure. Own malloc-backed script buffers with a unique_ptr/free deleter in coremini_load and load_readbin so all returns and exception exits release storage. Check allocation failure, tuple length narrowing, and integer conversion errors while preserving byte conversion behavior and the native ABI.

Fixes #247

Validation:

  • Rebuilt Windows x64 CPython 3.14.5 extension in an isolated worktree.
  • Baseline: all four new file/tuple success/failure leak cases failed, retaining about 32 MiB over 32 calls.
  • Fixed full suite: 34 passed, 4 skipped. Mock libraries validate payload bytes without hardware; tests cover native failures, conversion errors, empty inputs, and missing files.
  • Four skips are specifically load_readbin: the public build does not expose this internal-header-only entry point. Its ownership fix was source-reviewed, not runtime-validated.
  • Memory-growth assertions run on Windows; behavioral checks also support Linux/macOS mock libraries. Allocation failure and short-read fault injection were not run.
  • Independent critic /root/critic247: "I explicitly agree with the final diff. No blocking findings." Independent focused tests: 4 passed, 4 skipped. Builder explicitly agrees with the same diff. Renewed review includes the Windows fixture correction; reviewed diff became commit 12bca98 (base 45167e0).
  • Windows fixture targets Python bitness and exports undecorated i686 stdcall aliases; all child processes have 60s timeouts. Forced i686 fixture compilation and llvm-readobj verified PE I386 and both undecorated exports. No 32-bit Python runtime was exercised locally.
  • git diff --check passed. CI pending; no hardware operations performed.

Parent coordinator retains CI acceptance, integration, hardware testing, and merge responsibility.

@drebbe-intrepid
drebbe-intrepid merged commit 3f5f9f3 into master Sep 16, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P2] coremini_load leaks the entire script allocation on every call

1 participant