You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix a stack corruption issue in CFRegularExpression
The function _CFRegularExpressionEnumerateMatchesInString() walks the text
searching for occurrences of the pattern. For every occurrence, it populates
a CFRange array. If the number of capture groups is not greater than 7, it
uses an array on the stack (instead of mallocing one). However, the total
number of CFRanges inserted is (number of capture groups + 1). The last
insert can corrupt the stack if the number of capture groups is 7.
Copy file name to clipboardExpand all lines: TestFoundation/TestNSRegularExpression.swift
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -199,6 +199,8 @@ class TestNSRegularExpression : XCTestCase {
199
199
replaceRegularExpressionTest("\\b(th[a-z]+) \\1\\b",.CaseInsensitive,"This this is the the way.",[],NSMakeRange(0,25),NSRegularExpression.escapedTemplateForString("*\\$1*"),2,"*\\$1* is *\\$1* way.")
200
200
replaceRegularExpressionTest("\\b(th[a-z]+) \\1\\b",.CaseInsensitive,"This this is the the way.",[],NSMakeRange(0,25),"*\\$1*",2,"*$1* is *$1* way.")
201
201
replaceRegularExpressionTest("\\b(th[a-z]+) \\1\\b",.CaseInsensitive,"This this is the the way.",[],NSMakeRange(0,25),"*\\\\\\$1*",2,"*\\$1* is *\\$1* way.")
202
+
replaceRegularExpressionTest("([1-9]a)([1-9]b)([1-9]c)([1-9]d)([1-9]e)([1-9]f)",[],"9a3b4c8d3e1f,9a3b4c8d3e1f",[],NSMakeRange(0,25),"$2$4 is your key",2,"3b8d is your key,3b8d is your key")
203
+
replaceRegularExpressionTest("([1-9]a)([1-9]b)([1-9]c)([1-9]d)([1-9]e)([1-9]f)([1-9]z)",[],"9a3b4c8d3e1f2z,9a3b4c8d3e1f2z",[],NSMakeRange(0,29),"$2$4$1 is your key",2,"3b8d9a is your key,3b8d9a is your key")
0 commit comments