Project

General

Profile

Actions

Bug #13352

closed

RegExp infinite looping

Added by jumnichi_kose (小瀬 淳一) about 7 years ago. Updated about 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32], ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
[ruby-dev:50029]

Description

ruby entered an infinite loop with the following three steps.

r = /(?=\W)\W?(?:(?:(?:\/\*<)?[\'\"]?([\w_\$]+)[\'\"]?(?:>\*\/\s+this)?|(this))\.(\$scope|json)|([\'\"](?:\$scope|json)[\'\"]))((\.)(inputObjects)|(\.)(spreadSheets)(?:\.[\'\"]?([^\.\'\"\|\s,]+)[\'\"]?|\[[\'\"]?((?:[^\'\"\]\[]*|\[[^\]]*\])*)[\'\"]?\])(\.)(model))\s*(?:\.[\'\"]?([^\.\'\"\|\s,]+)[\'\"]?|\[[\'\"]?((?:[^\'\"\]\[]*|\[[^\]]*\])*)[\'\"]?\])/
txt = ".model |,| 'anController'.$scope.inputObjects['fieldName .../* !! comment ...*/"
txt.scan r

Node.js also falls into an infinite loop.

var r = /(?=\W)\W?(?:(?:(?:\/\*<)?[\'\"]?([\w_\$]+)[\'\"]?(?:>\*\/\s+this)?|(this))\.(\$scope|json)|([\'\"](?:\$scope|json)[\'\"]))((\.)(inputObjects)|(\.)(spreadSheets)(?:\.[\'\"]?([^\.\'\"\|\s,]+)[\'\"]?|\[[\'\"]?((?:[^\'\"\]\[]*|\[[^\]]*\])*)[\'\"]?\])(\.)(model))\s*(?:\.[\'\"]?([^\.\'\"\|\s,]+)[\'\"]?|\[[\'\"]?((?:[^\'\"\]\[]*|\[[^\]]*\])*)[\'\"]?\])/
var txt = ".model |,| 'anController'.$scope.inputObjects['fieldName .../* !! comment ...*/"

var s =r.exec (txt)

console.log(s)


Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0