Overly large array allocation may panic with "integer overflow"
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend
Direzione di ricerca
Start with the Array.replicate and ByteArray.emptyWithCapacity reproductions in the issue, then trace their runtime allocation paths and relevant tests. Reproduce the reported overflow with Lean 4.35.0 and compare interpreted and compiled behavior. Done means oversized requests are accepted or rejected gracefully without an uncaught runtime panic.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Prerequisites
- [ x] Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - [ x] Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
locally reproduced with nightly - When reporting a perceived soundness bug: Does it affect
lake check --paranoid?
If in doubt, please reach out on [email protected] for responsible disclosure.
Description
Minimal repro:
-- Repro.lean (lean-toolchain: leanprover/lean4:v4.35.0)
def main : IO Unit := do
let n : Nat := 2^61 -- 2^61 * sizeof(void*) overflows size_t on 64-bit
IO.println s!"allocating Array of {n} elements"
let a := Array.replicate n (0 : Nat)
IO.println s!"size = {a.size}"
$ lean --run Repro.lean
INTERNAL PANIC: integer overflow in runtime computation (exit 1)
Variants:
┌───────────────────────────────────────────────┬─────────────────────────────────────────────────────────┐
│ Case │ Interpreted and compiled │
├───────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ Array.replicate (2^60) │ INTERNAL PANIC: out of memory │
├───────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ Array.replicate (2^61) │ INTERNAL PANIC: integer overflow in runtime computation │
├───────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ ByteArray.emptyWithCapacity (2^63) and (2^64) │ out of memory │
├───────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ Array.replicate (2^61) inside try … catch │ still aborts; not catchable │
└───────────────────────────────────────────────┴─────────────────────────────────────────────────────────┘
Expected behavior: [Clear and concise description of what you expect to happen]
Accept the program or a graceful rejection instead of a panic.
Actual behavior: [Clear and concise description of what actually happens]
Panic
Versions
4.35.0, reproduced on Linux and Mac.
Additional Information
[Additional information, configuration or data that might be necessary to reproduce the issue]
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
- Lingua principale
- Lean
- Stelle
- 10.3k
- Fork
- 1.1k
- Merge medio
- 19h 8m
- PR unite (30g)
- 421
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di leanprover/lean4
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
leanprover/lean4#16681 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
leanprover/lean4#16305 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
leanprover/lean4#16299 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
leanprover/lean4#16257 ·
I maintainer di solito rispondono entro 1 giorno
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
leanprover/lean4#15683 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di leanprover/lean4
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
Upgrade Django to 5.2.18Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
blacklanternsecurity/bbot#3678 ·
I maintainer di solito rispondono entro 2 giorni
-
A failed hydrate call can be dropped when the row's wait is ready tooForse già presa @turbot-agent-fleet l’ha presa oggi. Apertaagent:ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
turbot/steampipe-plugin-sdk#1018 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
router-for-me/CLIProxyAPI#7976 ·
I maintainer di solito rispondono entro 1 giorno