grape-swagger icon indicating copy to clipboard operation
grape-swagger copied to clipboard

memory issues with large ranges

Open carlshimer opened this issue 11 years ago • 2 comments

I had an API definition that looked like:

requires :blahvalue, :type => Integer, values: 1262358112..3000000000, :desc => "foo"

This was designed to use a range to check to do basic validation. However, this blows up in the following code:

enum_values = enum_values.to_a if enum_values && enum_values.is_a?(Range)

to_a expands the range completely into an array. Which is very dangerous :)

carlshimer avatar Apr 07 '15 16:04 carlshimer

This has been discussed and is definitely a problem, I'd appreciate a PR/fix.

dblock avatar Apr 07 '15 18:04 dblock

Actually dup with https://github.com/tim-vandecasteele/grape-swagger/issues/235.

dblock avatar Apr 07 '15 18:04 dblock