xihaian251 commented on PR #947:
URL: https://github.com/apache/burr/pull/947#issuecomment-6917354796
Hi @elijahbenizzy — thanks for the work on #947. I independently validated
the resource-bound behavior against upstream `main` (`36e3ff3`) and this PR
head (`4e2aa03a879621c1c4fe44be205e8086419c49c2`) using resource-capped
subprocesses. The headline #1043 cases (`10 ** 10 ** 10` and `'a' *
10000000000`) are rejected at condition construction on this PR, while
ordinary-expression controls still pass.
One **non-blocking consistency gap** remains: the 4096-bit integer-result
backstop is applied in `_eval_BinOp`, but not to results returned by
allowlisted builtins or unary operators. For example, `int("9" * 4300)`
produces a 14,285-bit integer on the current head, even though `2 ** 4095` is
rejected. This is a mismatch with the documented result-width invariant,
**not** a new high-severity vulnerability or a syntax escape; the existing
repeat and sequence caps still bound the input.
I prepared an optional, directly applicable two-file patch based on exactly
this PR head: [commit
5912ba65815a42a18557c871589821c95b95867b](https://github.com/xihaian251/burr/commit/5912ba65815a42a18557c871589821c95b95867b).
It applies the existing width check to builtin and unary results and rejects
over-width `int(str/bytes)` values before expensive conversion, without
changing any existing resource constants. Unicode decimal digits, `base=0`
prefixes, explicit bases 2–36, bytes and native invalid-literal errors are
preserved; very long inputs that cannot be classified are conservatively
rejected (documented tradeoff).
Verification on this exact base: 87/87 targeted `safe_expr` tests pass (PR
baseline 76/76); Core suite is 447 passed / 4 failed versus 436 passed / 4
failed on the PR baseline, with the same four Graphviz environment failures.
`flake8` passes; black/isort fail identically before and after with the tool
versions available here. Python 3.10–3.13 were checked with bounded
cross-version semantic probes; complete pytest was run only in the Python 3.13
environment. The hosted CI matrix was not run.
The commit has the PR head as its only parent and can be cherry-picked,
applied as a patch, or used as reference for your own integration. It is
**optional** and not required for the two original #1043 cases — please feel
free to incorporate it, adapt it, or leave it for a follow-up. I did not open a
competing PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]