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

Đang mở
#9,569 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@rohan4naik đang làm issue này rồi.

Từ ngày 3/12/2026.

  • #9604 của @rohan4naik — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, rust
Lĩnh vực
backend, testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
5.5k
Fork
869
Merge trung bình
8 giờ 2 phút
Pull request đã merge (30 ngày)
862

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/opendal

Tất cả issue của apache/opendal

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.