noCV
SFFI-102 · Establish the machine contract

Validate lengths before converting JavaScript buffers

Practice briefBugFoundational

A signed length crosses the C boundary and becomes a very large unsigned value.

Focused work estimate
1h 30m + prerequisites
Priority in the scenario
Medium
Engineering practice
Integer conversion · Input validation

Estimated field mix

  • Systems programming70%
  • Security30%

Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.

Your next step

Review it, then add it to your workspace.

The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.

Project context

A fictional desktop backup tool calls a small Rust compression library from Node.js. The binding leaks buffers on exceptions and treats ABI mismatches as corrupted input. Build against generated byte arrays and a local native library; no production archive format or user files are supplied.

Setup prerequisites

  • FFI ownership
  • Binary compatibility
  • Error handling

Preceding work

No earlier ticket is required. Complete the project setup above.

Acceptance criteria

  • Binding rejects lengths outside the actual buffer and native type range
  • Zero-length input follows a documented contract
  • Conversion failure calls no compression function

Implementation constraints

  • Perform validation on the boundary side that has both pointer and buffer length.

Verification to include

  • Compress empty, small, and maximum-fixture buffers.
  • Pass negative-equivalent, oversized, and detached buffers and verify rejection.

Deliverables

  • Length checks and boundary corpus

Rollout and recovery

Reject unsupported buffers before enabling the native path.

Value of the work

For the engineer: Practice language-boundary contracts, native resource safety and version negotiation.

For the team: Review a binding that fails safely and can be rolled back before native code enters additional application paths.

Evidence boundaries

Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.

Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.