Actions
Bug #4050
closedsegfault while using regex in an infinite loop
Description
=begin
While learning ruby, I noticed that Regex matches were kept in memory to be able to access groups elements
with $1, $2, and so on later in the code.
So I wondered if this could fill my memory, and tried the following code:
s = "a"
while true do
s = s*2
s[/a+/]
end
Which lead to a segmentation fault.
(here is the full backtrace from irb: http://www.ideone.com/kNioo )
I first thought that it was because my "s" variable was getting bigger and bigger, but after a simple
test I noticed that it threw an ArgumentError.
Shouldn't this throw an exception too? so it could be caught in the code.
If I missed something (as said, i'm really new to ruby) and this report is pointless, I'm sorry,
otherwise I hope it will be useful.
Best regards.
Mat
=end
Actions
Like0
Like0Like0