Skip to content

Raise OverflowError for oversized pickle lengths - #9040

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-pickle-length-overflow
Oct 10, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-pickle-length-overflow

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Raise OverflowError with CPython 3.14's messages when advertised pickle lengths exceed the platform maximum. Preserve the existing rejection before payload reads or allocation.

Extracted from #8954. The existing pickle snippet uses only 11-byte headers to cover bytes, Unicode, and frame lengths through both load entry points. Canonical assertions remain unchanged.

Validation:

  • CPython 3.14.7 passes the snippet; the pre-fix RustPython baseline raises UnpicklingError instead.
  • Source review verified early rejection before every bounded runtime check.
  • Normal pre-commit hooks and stdlib Clippy pass.
  • Patched native runtime and aggregate tests await CI; local runtime linking is blocked by available disk space.

AI-assisted implementation, tests, and review with OpenAI Codex. Kept as a draft for CI and maintainer review.

Main-branch conflict refresh (2026-10-10)

Rebased the independent change onto main c516ca95dfd77ea76ac4df2b152aca9e88d3a6bc after #9037 added wrapper-pickle coverage at the same snippet append point. Both regression blocks are preserved unchanged; the production file is byte-identical to the original PR head. Independent review and AST/byte preservation checks passed.

Normal hooks, the complete existing pickle snippet on CPython 3.14.7 and the native candidate, both snippet pytest entries, four unchanged canonical unpickler tests, stdlib Clippy and separately configured CAPI Clippy passed on the refreshed head. The previously green CI applies to the old head only; fresh exact-head CI is required.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 52a56764-de72-42a0-b24e-d3b00b7fa870

📥 Commits

Reviewing files that changed from the base of the PR and between fd062ca and ee9664f.


📒 Files selected for processing (2)
  • crates/stdlib/src/pickle.rs
  • extra_tests/snippets/stdlib_pickle.py

 ______________________________________________________
< Unit tests are cute. Integration tests pay the rent. >
 ------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Preserve the wrapper-pickle regressions merged into main while refreshing the independent length checks.

Assisted-by: OpenAI Codex:model identifier unavailable
@youknowdot
youknowdot force-pushed the fix-pickle-length-overflow branch from 7bcc37e to ee9664f Compare October 10, 2026 10:55
@youknowone
youknowone marked this pull request as ready for review October 10, 2026 15:51
@youknowone
youknowone merged commit be52c97 into RustPython:main Oct 10, 2026
20 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T15:54:24.886983Z ee9664f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee9664f9bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

assert _pickle.loads(_pickle.dumps(object.__str__)) is object.__str__

# Oversized advertised lengths are rejected before trying to read or allocate.
for opcode, name in (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the forbidden test-logic changes

This block adds new test data, control flow, and assertions to a test file, but the repository rules restrict test-file changes to adding or removing expectedFailure decorators. Revert or relocate this regression block rather than changing test logic here so the patch complies with the required test policy.

AGENTS.md reference: AGENTS.md:L273-L279

Useful? React with 👍 / 👎.

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.

2 participants