Skip to content

ref tools: hidden_ref accepts malformed numeric options #243

Closed

Description

@github-actions

In hidden_ref.cpp, -c bad is parsed by atoi as zero and then replaced with the prompt length at line 150. Likewise, -ngl bad becomes zero GPU layers and -t bad selects the default thread count. With otherwise valid arguments, invalid input runs inference and writes a completed reference set. Parse the entire integer with strtol, reject conversion and range errors by name, and use the checked conversion for every numeric option.

Evidence (at the base of #242):

Filed by Shingler, the review bot, while reviewing #242; the defect is outside that pull request.

Activity

  1. added
    review-botFiled by the PR review bot: a defect found outside the reviewed pull request
    on Oct 15, 2026
  2. added 5 commits that reference this issue on Oct 15, 2026
    0fb0c06
    918e0f6
    b261cc0
    972e034
    8fcd684
  3. juliankang4 commented on Oct 16, 2026

    @juliankang4
    Collaborator

    This is fixed on main by 7ed1967 ("refset: a nemotron id, completion count, or oracle numeric option that does not parse is refused"). tools/ref/hidden_ref.cpp no longer uses atoi for these options: -c, -ub, -ngl and -t go through parse_i32 (lines 86 to 92 on main), and a value that does not parse makes it return 2 before any inference runs. So -c bad, -ngl bad and -t bad are refused instead of becoming 0 or the default. Closing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    review-botFiled by the PR review bot: a defect found outside the reviewed pull request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions