ruby / ruby/fiddle

Unreachable code path in Fiddle::ValueUtil#wrap_arg

Open
#124 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
195
Forks
53
Avg merge
23h 57m
Merged PRs (30d)
1

Description

In Fiddle::ValueUtil#wrap_arg there is a long case-when for arg with an unreachable code path.
When arg and ty are of Array type, and ty[0] is TYPE_CHAR, there is another condition, for arg to be String at Line 101.
Even if this condition is fixed, val is undefined at Line 102 for this method.
https://github.com/ruby/fiddle/blob/04238cefed14a433f93909bd93dbe1d0a4efc47e/lib/fiddle/value.rb#L95-L106

Should Lines 100-103 be removed?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/fiddle/value.rb at Fiddle::ValueUtil#wrap_arg, especially lines 95-106 linked in the issue. Trace the Array and TYPE_CHAR branches to confirm the unreachable condition and undefined val, then determine whether lines 100-103 should be removed; done means the dead path is resolved without changing valid argument wrapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.