BartyCrouch
BartyCrouch copied to clipboard
Crashes while calling NSRegularExpression.firstMatch(in:options:range:)
We're using BartyCrouch as our build script phase. I found out that all version from 3.11.2 and newer are crashing with the following stack:
2018-11-14 11:15:58.401 bartycrouch[27535:1456155] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: Range or index out of bounds'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff3ad71e65 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff66dcd720 objc_exception_throw + 48
2 CoreFoundation 0x00007fff3ad71c97 +[NSException raise:format:] + 201
3 Foundation 0x00007fff3d077f3d -[NSRegularExpression(NSMatching) enumerateMatchesInString:options:range:usingBlock:] + 352
4 Foundation 0x00007fff3d0e3fbb -[NSRegularExpression(NSMatching) firstMatchInString:options:range:] + 143
5 bartycrouch 0x0000000106761c61 bartycrouch + 142433
6 bartycrouch 0x00000001067775e8 bartycrouch + 230888
7 bartycrouch 0x000000010677e392 bartycrouch + 258962
8 bartycrouch 0x00000001067410b0 bartycrouch + 8368
9 bartycrouch 0x0000000106748378 bartycrouch + 37752
10 bartycrouch 0x0000000106741047 bartycrouch + 8263
11 libdyld.dylib 0x00007fff67e9c08d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
/Users/podkovyrin/Library/Developer/Xcode/DerivedData/DashSync-acejhnkrxbeiyrbzivficvuxtfxq/Build/Intermediates.noindex/DashSync.build/Debug-iphonesimulator/DashSync_Example.build/Script-FB5A0FA7219506140079CF42.sh: line 8: 27535 Abort trap: 6 bartycrouch code -v -p "$PROJECT_DIR/../DashSync/" -l "$PROJECT_DIR/../DashSync/" -c -s -k -f "DSLocalizedString"
Command PhaseScriptExecution failed with a nonzero exit code
However, 3.11.1 works fine. And it looks like this commit breaks all new versions: https://github.com/Flinesoft/BartyCrouch/commit/4a1088d20d5350a5b05af6240c30f8ecf8d63455 You can try it yourself from building workspace in Example folder of https://github.com/dashevo/dashsync-iOS
Since you found the exact issue, would you be willing to fix it and post a PR with the fix? @podkovyrin Feel free to also add tests so this doesn't appear ever again in the future.
Can't reproduce on current version (v.4.0.0).