Skip to content

stack overflow caused by malformed url #19

@cout

Description

@cout

We noticed an illegal instruction occurring on osx (stack too deep exception on linux), and tracked it down to a url that looked like this:

    http://localhost:3000/portal/protocols/2?1

This causes parsed_nested_params in entry.rb to be passed a hash like this:

    {"1"=>nil, "id"=>"2"}

This results in parsed_nested_params() recursively calling itself until the stack blows up. When it reaches the nil value, parsed_nested_params is called recursively with the original params hash.

Simplest solution is to not use nil as a default:

    def parsed_nested_params params=deep_clone_hash(self.params)
      if params.kind_of? Hash
        params.each do |key,val| 
          params[key] = parsed_nested_params(params[key])
        end
      else
        return params.inspect
      end
      params
    end 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions