[erlang-questions] regexp:match crashes emulator

Ralf Doering rdoering@REDACTED
Fri Feb 15 11:20:43 CET 2008


Hi,

after having a typo in my code I observed that incorrect quoting in
regular expressions leeds to an endless loop in regexp:match, finally
crashing emulator due to out of memory.

Suppose I like to match strings starting with "*", and got regular
expression wrong: "^\*" instead of "^\\*".
Using this, I get a cpu loaded at 100% for some time and finally a crash.

,----
| Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false]
| 
| Eshell V5.6.1  (abort with ^G)
| 1> regexp:match("*A", "^\*").
| 
| Crash dump was written to: erl_crash.dump
| eheap_alloc: Cannot allocate 583848200 bytes of memory (of type "heap").
| Aborted (core dumped)
`----

This happens with both R12B-1 and R11B-5.

Is there any way to fix this?

TIA,
Ralf



More information about the erlang-questions mailing list