string->number hangs and OOMs on tiny payloads like "#e1e99999999" (unbounded allocation)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Domain
- backend
Research direction
Start by locating the implementation and tests for string->number, then trace how exact exponents are parsed and allocated. Reproduce with (string->number "#e1e99999999") under a timeout and inspect the related discussion for constraints. Done means untrusted input is refused within bounded time and memory, with regression coverage for the reproduction.
Written by the indexing model from the issue text.
Description
Calling (string->number "#e1e99999999") attempts to construct the exact integer 10^99999999.
Because the allocation is unbounded, this call never returns. It just spins and eats RAM—I watched a Scheme process balloon to 20 GB before it was finally killed.
This is a significant DoS risk. Any program that feeds untrusted user input into string->number can be locked up and OOM'd by a 12-character string.
The obvious mitigations don't actually work:
Forcing a radix: (string->number "#e1e99999999" 10) still hangs because the radix argument doesn't disable #e / #x prefixes.
Length limits: Bounding the input length doesn't help because the malicious part is just the exponent, which easily fits in a dozen characters.
To reproduce:
、、、
$ timeout 5 scheme -q <<< '(string->number "#e1e99999999")'
$ echo $?
124
、、、
Expected behavior:
There needs to be a bounded refusal (e.g., returning #f or throwing an exception when an exact exponent exceeds a reasonable limit). Alternatively, we need a documented, safe way to parse numbers from untrusted text. Right now, the only safe workaround is to manually validate the string's shape before passing it to string->number.
- Dominant language
- Scheme
- Stars
- 7.4k
- Forks
- 1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 19
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cisco/ChezScheme
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
cisco/ChezScheme#1110 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
cisco/ChezScheme#1111 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 12/100
cisco/ChezScheme#1101 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
cisco/ChezScheme#1078 · 1 comment ·
Maintainers usually reply within 1 day
-
RFC: solution to clangd not finding "scheme.h"Possibly taken @reginaldalfret claimed this 20 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
cisco/ChezScheme#1073 · 1 comment ·
Maintainers usually reply within 1 day
All issues in cisco/ChezScheme
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kludex/python-multipart#375 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Termix-SSH/Plugin-Hosts-Config#14 · 1 comment ·
Maintainers usually reply within 4 days
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
quantum-php/framework#692 ·
Maintainers usually reply within 1 day
-
area:web kind:bug priority:p2 ready
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 11 days