Skip to content

[Ruby 1.8.7, RDoc::Parser::C] "(RegexpError) Stack overflow in regexp matcher" #327

Closed
@sshao

Description

@sshao
  • ruby version: 1.8.7
  • rdoc version: 4.1.2

Given a C file like this (full file from the libxslt-ruby gem), RDoc 4.1.2 fails to generate documentation on ruby 1.8.7. However, RDoc 4.1.2 does successfully generate documentation for this same file on: rubinius 2.2.10, ruby 2.1.2p95, and ruby 1.9.3p547.

Below is the output I encountered using ruby 1.8.7 and RDoc 4.1.2:

$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-darwin13.4.0]
$ rdoc --version
4.1.2
$ rdoc ruby_xslt_stylesheet.c 
Parsing sources...
Before reporting this, could you check that the file you're documenting         
has proper syntax:

  /Users/Sophia/.rubies/ruby-1.8.7-p358/bin/ruby -c ruby_xslt_stylesheet.c

RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.

The internal error was:

        (RegexpError) Stack overflow in regexp matcher: /.*((?>\/\*.*?\*\/\s+))
                         ([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(LibXSLT)"/mx

uh-oh! RDoc had a problem:
Stack overflow in regexp matcher: /.*((?>\/\*.*?\*\/\s+))
                         ([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(LibXSLT)"/mx

run with --debug for full backtrace
$ rdoc ruby_xslt_stylesheet.c --debug
Parsing sources...
Before reporting this, could you check that the file you're documenting         
has proper syntax:

  /Users/Sophia/.rubies/ruby-1.8.7-p358/bin/ruby -c ruby_xslt_stylesheet.c

RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.

The internal error was:

        (RegexpError) Stack overflow in regexp matcher: /.*((?>\/\*.*?\*\/\s+))
                         ([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(LibXSLT)"/mx

/Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:748:in `find_class_comment'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:897:in `handle_class_module'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:423:in `do_define_module'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:421:in `scan'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:421:in `do_define_module'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:524:in `do_modules'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:1212:in `scan'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:367:in `parse_file'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:420:in `parse_files'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:418:in `map'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:418:in `parse_files'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:488:in `document'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/bin/rdoc:20
        /Users/Sophia/.gem/ruby/1.8.7/bin/rdoc:23:in `load'
        /Users/Sophia/.gem/ruby/1.8.7/bin/rdoc:23
Stack overflow in regexp matcher: /.*((?>\/\*.*?\*\/\s+))
                         ([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(LibXSLT)"/mx
/Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:748:in `find_class_comment'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:897:in `handle_class_module'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:423:in `do_define_module'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:421:in `scan'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:421:in `do_define_module'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:524:in `do_modules'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/parser/c.rb:1212:in `scan'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:367:in `parse_file'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:420:in `parse_files'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:418:in `map'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:418:in `parse_files'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/lib/rdoc/rdoc.rb:488:in `document'
        /Users/Sophia/.gem/ruby/1.8.7/gems/rdoc-4.1.2/bin/rdoc:20
        /Users/Sophia/.gem/ruby/1.8.7/bin/rdoc:23:in `load'
        /Users/Sophia/.gem/ruby/1.8.7/bin/rdoc:23

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions