marcelog / ex_abnf

Parser for ABNF Grammars
Apache License 2.0
61 stars 12 forks source link

Crash on RFC7644 filter grammar #16

Open tanguilp opened 5 years ago

tanguilp commented 5 years ago

Hi,

I've tried to use the grammar at https://tools.ietf.org/html/rfc7644#section-3.4.2.2 with ex_abnf parser. Here is the file: filter.txt

Had to add a few definitions from other specs (like ALPHA and DIGIT at the bottom).

Here are the last commands before the crash:

iex(4)> grammar = ABNF.load_file("priv/filter.abnf")                     
%{
...}
iex(5)> initial_state = %{}                                              
%{}
iex(6)> ABNF.apply(grammar, "FILTER", "userName sw \"J\"", initial_state)
eheap_alloc: Cannot allocate 1318267840 bytes of memory (of type "heap").

Crash dump is being written to: erl_crash.dump...done

Seems similar to an infinite loop?

tanguilp commented 5 years ago

It seems that infinite recursion was allowed in the original document - corrected here: https://www.rfc-editor.org/errata/eid4690