Skip to content

Conversation

id-ilych
Copy link

@id-ilych id-ilych commented Jul 26, 2025

Passing negative integer input causes infinite loop as number will always be negative and never gets to zero

number = input_val
result = ""
while(number != 0)
result = @BASE_PRIMITIVES_ARRAY[number % @BASE_PRIMITIVES_ARRAY.size ].to_s + @delim + result
number = Integer(number/@BASE_PRIMITIVES_ARRAY.size)
end

With that it's better to raise right away. Since other cases also raise RuntimeError I used it instead of ArgumentError for the sake of consistency.

Copy link

Review changes with  SemanticDiff

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