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

オープン
#9,569 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@rohan4naik がすでに取り組んでいます。

2026年12月3日 から。

  • #9604 @rohan4naik による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, rust
領域
backend, testing

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
5.5k
フォーク
869
平均マージ
8時間 2分
マージ済み PR(30日)
862

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/opendal のほかの issue

apache/opendal の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。