View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0014921 | MMW v4 | Framework: Scripts/Extensions | public | 2018-06-28 22:23 | 2018-07-09 20:51 |
Reporter | zvezdan | Assigned To | |||
Priority | high | Severity | minor | Reproducibility | random |
Status | resolved | Resolution | unable to reproduce | ||
Product Version | 4.0.7 | ||||
Target Version | 4.1.22 | ||||
Summary | 0014921: Untrapable AV error with RegEx | ||||
Description | I am getting the Access Violation error with the RegExp object that is not trappable with On Error Resume Next. The next RegEx pattern is not quite optimized, in fact it produces the unwanted result, but it should work fine. The pattern is: ()(\s*)()(?!(?:.*? - ){2,}).*?( - )(\s*)(?=(?:.*? - ){1}) The replacement is: $1$2$3$5 The test string is: A - B - C - D - E It is tested on several on-line RegEx testers and nowhere produced any problem, it is not making browser unresponsive or anything like that: https://regexr.com/ https://regex101.com/#javascript http://rextester.com/replace I believe that you are doing something wrong with RegEx engine in your program which also caused the recent problem with Windows Defender and my another scripts that use extensively the MatchCollection object during startup, as I described in the related Issue (https://www.ventismedia.com/mantis/view.php?id=14820#c50347). | ||||
Steps To Reproduce | Here is the test VBScript which could be started directly from the command line, it doesn't produce any error or any similar problem: Option Explicit Dim oRegEx Set oRegEx = New RegExp oRegEx.IgnoreCase = True oRegEx.Global = True oRegEx.Multiline = False oRegEx.Pattern = "()(\s*)()(?!(?:.*? - ){2,}).*?( - )(\s*)(?=(?:.*? - ){1})" MsgBox oRegEx.Replace("A - B - C - D - E", "$1$2$3$5") Now, here is the MM test script which produces the mentioned AV error followed with another message box saying "Variant or safe array is locked", but it does not happen always. I cannot find out how to reproduce it reliably, it seems that it depends of what files are displayed in the filelist and/or Now Playing panel: Option Explicit Sub OnStartUp() Dim oMenuItem Set oMenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_File, 0, 0) oMenuItem.Caption = "RegEx test" oMenuItem.OnClickFunc = "Test" oMenuItem.UseScript = Script.ScriptPath End Sub Sub Test(oMenuItem) Dim oRegEx Dim sTmp Set oRegEx = New RegExp oRegEx.IgnoreCase = True oRegEx.Global = True oRegEx.Multiline = False On Error Resume Next oRegEx.Pattern = "()(\s*)()(?!(?:.*? \- ){2,}).*?( \- )(\s*)(?=(?:.*? \- ){1})" sTmp = oRegEx.Replace("A - B - C - D - E", "$1$2$3$5") SDB.MessageBox sTmp, mtInformation, Array(mbOk) On Error GoTo 0 End Sub Note the On Error Resume Next line which has no effect in this case. | ||||
Tags | No tags attached. | ||||
Fixed in build | |||||
|
http://www.mediamonkey.com/forum/viewtopic.php?f=1&t=90485&e=1&view=unread#p447221 |
|
RegEx is not our object, it is VBScript's object -- so I don't see how we could affect this by our application. I cannot replicate any AV with the testing script. The script is just taking result of RegEx.Replace (which is string) and shows the string using our SDB.MessageBox |