Project

General

Profile

Bug #3143

Updated by jeremyevans0 (Jeremy Evans) 3 months ago

=begin

While playing around with the possibility of a simpler AOP library for ruby than Aquarium (and without using ParseTree), I've found a very strange segmentation fault. The attached code file shows it happing. As it is very exploratory code, it is filled with some very unusual meta-programming that, when cleaned up with proper modularization, prevent the bug from happening.

What is weird is that commenting a few lines of the code change the segmentation fault into the following error:

meta_define_inline_blockeasy_seg_fault.rb:46:in `new': stack level too deep (SystemStackError)

The commented lines are marked in the file, but I repeate them for completeness sake:
## Commenting the following two lines the seg fault turn into `new': stack level too deep
regex = /#<Module\:0x(\w+)/
uniquename = regex.match(to_s)[1]
##

Not a big issue, as the real library will not open Class and redefine new, but I found interestnig. And worried, since seg faults can sometimes be exploited into bigger issues.

=end

Back