Skip to content

fix: harden rpscan argument parsing - #4

Open
sit-d wants to merge 1 commit into
bitRAKE:mainfrom
sit-d:curation/source-followup-2026-07-03
Open

fix: harden rpscan argument parsing#4
sit-d wants to merge 1 commit into
bitRAKE:mainfrom
sit-d:curation/source-followup-2026-07-03

Conversation

@sit-d

@sit-d sit-d commented Jul 3, 2026

Copy link
Copy Markdown

Summary

  • reject signed or blank --max-depth values before calling wcstoull
  • reject parsed values above UINT32_MAX instead of silently truncating them into the uint32_t depth limit
  • copy the variadic argument list before the first formatting attempt so the fallback formatting path does not reuse an already-consumed va_list

Verification

  • gcc -Wall -Wextra -Werror /tmp/hermes-verify-tools-rpscan-*.c -o /tmp/hermes-verify-tools-rpscan-* on a dependency-free extraction of parse_u32
  • ran the verifier binary against valid boundary cases (0, 42, 0xffffffff, 4294967295) and invalid cases (blank, signed, trailing junk, 4294967296, 0x100000000)
  • git diff --check

The temporary verifier exited 0 and was removed.

Notes / limitations

@sit-d

sit-d commented Jul 3, 2026

Copy link
Copy Markdown
Author

Fresh post-PR verification: ad-hoc verifier /tmp/hermes-verify-tools-rpscan-post-33kf3wdu.c compiled with gcc -Wall -Wextra -Werror, exercised parse_u32 boundary/invalid cases (0, 42, 0xffffffff, 4294967295, blank/signed/trailing-junk/overflow inputs), checked rpscan.c contains the va_copy/va_end and UINT32_MAX/sign guards, and ran git diff --check HEAD~1..HEAD. It exited 0; verifier source and binary were removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant