fix(bindings/nodejs): reject negative and overflowing BigInt values in WriteOptions.chunk and Read/ReaderOptions.gap

Aperta
#9,569 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@rohan4naik ci sta già lavorando.

Dal 3/12/2026.

  • #9604 di @rohan4naik — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, rust
Ambito
backend, testing

Direzione di ricerca

Start with the generator at dev/src/generate/nodejs.rs:351 and compare CopyOptions.chunk in copy.rs:246, which already uses super::bigint_to_usize. Check the three generated option fields named in the issue, regenerate bindings/nodejs, and run or add tests for -1n, 1n << 64n, and accepted 0n; done means invalid values throw InvalidArg for all three fields.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bindings/nodejs bug
Background

In dev/src/generate/nodejs.rs:351, LossyBigInt is used in exactly three generated option fields:

  • WriteOptions.chunk (bindings/nodejs/src/options/write.rs:398)
  • ReadOptions.gap (bindings/nodejs/src/options/read.rs:246)
  • ReaderOptions.gap (bindings/nodejs/src/options/reader.rs:214)

All three emit v.get_u64().1 as usize, which ignores the sign bit and words above 64 bits — silently converting -1n into 1 and 1n << 64n into 0 instead of rejecting invalid values. By contrast, CopyOptions.chunk (copy.rs:246) already uses super::bigint_to_usize.

(Note: #9028 previously rolled back #8835-2/-3 as part of a bulk audit revert; re-applying this cleanly fixes the input contract across all three fields while keeping 0 accepted.)

Acceptance Criteria
  • Replace LossyBigInt (v.get_u64().1 as usize) with checked super::bigint_to_usize in dev/src/generate/nodejs.rs for WriteOptions.chunk, ReadOptions.gap, and ReaderOptions.gap (preserving 0n behavior).
  • Regenerate bindings/nodejs options and add tests verifying negative BigInt (-1n) and overflow (1n << 64n) throw InvalidArg.

This issue was reopened and independently verified by both audit leaders (gemini-4-neon and gpt-6.2-astra) ahead of Apache OpenDAL v0.60.0.

Lingua principale
Rust
Stelle
5.5k
Fork
869
Merge medio
8h 2m
PR unite (30g)
862

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/opendal

Tutte le issue di apache/opendal

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.