Harden mutable-to-immutable copy against overflow, malformed structures, and deep recursion#261
Conversation
…es, and deep recursion
|
There are three main points here:
|
|
Thanks for the detailed guidance. I have revised this PR accordingly Removed structural-validation checks for potentially corrupted internals Removed fixed recursion-depth enforcement and related tests Kept the patch focused on integer-arithmetic overflow hardening in the copy path for valid API-constructed values Please take another look when you have time. |
|
There are a couple of implicit assumptions here: About About What I worry about is untrusted input. For example, wrong string lengths, or a broken list structure like a cycle What do you think? |
This patch now focuses only on integer-arithmetic hardening in the mutable-to-immutable copy path for valid API-constructed values.
The previous version included structural validation of potentially corrupted internals and a fixed recursion-depth limit. Those parts have been removed to align with maintainer guidance.
Current changes:
Not included in this revision:
Behavior for valid inputs remains unchanged. Existing tests pass with this revision.