Skip to content

Commit 2dedbb9

Browse files
Merge pull request #1161 from sanfrancrisko/IAC-1414/main/fix_range_invalid_step_arg
(IAC-1414) Throw error in range() function when step size invalid
2 parents 9a8f097 + 14e6d11 commit 2dedbb9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/puppet/parser/functions/range.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ module Puppet::Parser::Functions
5151
stop = arguments[1]
5252
step = arguments[2].nil? ? 1 : arguments[2].to_i.abs
5353

54+
raise(ArgumentError, 'range(): 3rd arg (step size) must be a non zero integer (e.g. 1 or -1)') if step.zero?
55+
5456
type = '..' # Use the simplest type of Range available in Ruby
5557

5658
else # arguments.size == 1

0 commit comments

Comments
 (0)