Project

General

Profile

Actions

Defect #11941

closed

RexexpError when parsing commit log with many #nnnn and ruby1.8

Added by Cheyenne Wills about 12 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Wont fix
Affected version:

Description

We have a large commit log that has a bunch of strings in the format of #nnnn (208 in total). Redmine changeset fetch processing is failing with a stack overflow in the regular expression scan of the commit log.

Attached is a file that contains the string from the commit log that will reproduce the error. Reusing the regular expression that is created in changesets.rb the following code snippet will reproduce the problem

s = IO.readlines("bad").join()
s.scan(/([\s\(\[,-]|^)((refs|references|issueid|issueid|defectid|defectid|fixes|closes|resolves|fixes|closes|resolves)[\s:]+)?(#\d+(\s+@(?x-mi:(((\d+)(h|hours?))((\d+)(m|min)?)?|((\d+)(h|hours?|m|min))|(\d+):(\d+)|(\d+([\.,]\d+)?)h?)))?([\s,;&]+#\d+(\s+@(?x-mi:(((\d+)(h|hours?))((\d+)(m|min)?)?|((\d+)(h|hours?|m|min))|(\d+):(\d+)|(\d+([\.,]\d+)?)h?)))?)*)(?=[[:punct:]]|\s|<|$)/i)
RegexpError: Stack overflow in regexp matcher:...

Info about our environment

RAILS_ENV=production ruby script/about
About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.3.7
Rack version              1.1.3
Rails version             2.3.14
Active Record version     2.3.14
Active Resource version   2.3.14
Action Mailer version     2.3.14
Active Support version    2.3.14
Application root          /var/lib/redmine
Environment               production
Database adapter          mysql
Database schema version   20110902000000

About your Redmine plugins
Mylyn Connector plugin              2.7.4.stable
Project Subscription                0.0.1b
Redmine ChangeAuthor plugin         0.0.2
Redmine Vendor Display plugin       1.0
Redmine Groups plugin               1.0.0
Redmine Better Gantt Chart plugin   0.6.1

Backtrace

Sep 24 15:38:38 penguin1 Redmine[21183]: RegexpError (Stack overflow in regexp matcher: /([\s\(\[,-]|^)((refs|references|issueid|issueid|defectid|defectid|fixes|closes|resolves|fixes|closes|resolves)[\s:]+)?(#\d+(\s+@(?x-mi:
Sep 24 15:38:38 penguin1 (
Sep 24 15:38:38 penguin1 ((\d+)(h|hours?))((\d+)(m|min)?)?
Sep 24 15:38:38 penguin1 |
Sep 24 15:38:38 penguin1 ((\d+)(h|hours?|m|min))
Sep 24 15:38:38 penguin1 |
Sep 24 15:38:38 penguin1 (\d+):(\d+)
Sep 24 15:38:38 penguin1 |
Sep 24 15:38:38 penguin1 (\d+([\.,]\d+)?)h?
Sep 24 15:38:38 penguin1 )
Sep 24 15:38:38 penguin1 ))?([\s,;&]+#\d+(\s+@(?x-mi:
Sep 24 15:38:38 penguin1 (
Sep 24 15:38:38 penguin1 ((\d+)(h|hours?))((\d+)(m|min)?)?
Sep 24 15:38:38 penguin1 |
Sep 24 15:38:38 penguin1 ((\d+)(h|hours?|m|min))
Sep 24 15:38:38 penguin1 |
Sep 24 15:38:38 penguin1 (\d+):(\d+)
Sep 24 15:38:38 penguin1 |
Sep 24 15:38:38 penguin1 (\d+([\.,]\d+)?)h?
Sep 24 15:38:38 penguin1 )
Sep 24 15:38:38 penguin1 ))?)*)(?=[[:punct:]]|\s|<|$)/i):
Sep 24 15:38:38 penguin1 app/models/changeset.rb:128:in `scan'
Sep 24 15:38:38 penguin1 app/models/changeset.rb:128:in `scan_comment_for_issue_ids'
Sep 24 15:38:38 penguin1 app/models/changeset.rb:101:in `scan_for_issues'
Sep 24 15:38:38 penguin1 app/models/repository/subversion.rb:67:in `fetch_changesets'
Sep 24 15:38:38 penguin1 app/models/repository/subversion.rb:66:in `fetch_changesets'
Sep 24 15:38:38 penguin1 app/models/repository/subversion.rb:65:in `reverse_each'
Sep 24 15:38:38 penguin1 app/models/repository/subversion.rb:65:in `fetch_changesets'
Sep 24 15:38:38 penguin1 app/controllers/repositories_controller.rb:92:in `show'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/rack/request_handler.rb:96:in `process_request'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/utils.rb:479:in `safe_fork'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:357:in `__send__'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:180:in `start'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:357:in `__send__'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
Sep 24 15:38:38 penguin1 /usr/lib64/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
Sep 24 15:38:38 penguin1 /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:99
Sep 24 15:38:38 penguin1 Redmine[21183]: Rendering /var/lib/redmine/public/500.html (500 Internal Server Error)

Files

bad (2.03 KB) bad Data that can reproduce the problem Cheyenne Wills, 2012-09-25 20:47
Actions

Also available in: Atom PDF