[Bug 53807] New: vbscript fails to redim original array in function when passed byref
https://bugs.winehq.org/show_bug.cgi?id=53807 Bug ID: 53807 Summary: vbscript fails to redim original array in function when passed byref Product: Wine Version: 7.16 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: vbscript Assignee: wine-bugs(a)winehq.org Reporter: jsm174(a)gmail.com Distribution: --- While working on leveraging the vbscript engine of Wine for a macos/linux port of Visual Pinball, I ran into a script that resizes an array in a function by passing the array in byref. When the function finishes, the array appears to be at the original size. Take the following code: dim ax redim ax(4) Function Resize(byref x2) Wscript.Echo "IN RESIZE BEFORE: " & UBound(x2) Redim x2(20) Wscript.Echo "IN RESIZE AFTER: " & UBound(x2) End Function Wscript.Echo "BEFORE: " & UBound(ax) Resize ax Wscript.Echo "AFTER: " & UBound(ax) In wine VBS: BEFORE: 4 IN RESIZE BEFORE: 4 IN RESIZE AFTER: 20 AFTER: 4 In real VBS: BEFORE: 4 IN RESIZE BEFORE: 4 IN RESIZE AFTER: 20 AFTER: 20 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 Jason Millard <jsm174(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jsm174(a)gmail.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 Jason Millard <jsm174(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|7.16 |7.19 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 --- Comment #1 from Jason Millard <jsm174(a)gmail.com> --- I spent a while debugging this. In interp_redim, before returning, it should look to see if the lookup_identifier ref is VT_BYREF. If so, get the V_VARIANTREF. Current: VariantClear(ref.u.v); V_VT(ref.u.v) = VT_ARRAY|VT_VARIANT; V_ARRAY(ref.u.v) = array; return S_OK; Fix: VARIANT *v = ref.u.v; if(V_VT(v) == (VT_VARIANT|VT_BYREF)) { v = V_VARIANTREF(v); } VariantClear(v); V_VT(v) = VT_ARRAY|VT_VARIANT; V_ARRAY(v) = array; return S_OK; -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #2 from Nikolay Sivov <bunglehead(a)gmail.com> --- I think this looks fine, it needs a test though. Let me know if you need help with that. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 --- Comment #3 from Jason Millard <jsm174(a)gmail.com> --- Great. I will work something up. That will give me practice with tests. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 --- Comment #4 from Nikolay Sivov <bunglehead(a)gmail.com> --- We'll also need a similar change to interp_redim_preserve(). -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 --- Comment #5 from Jason Millard <jsm174(a)gmail.com> --- submitted https://gitlab.winehq.org/wine/wine/-/merge_requests/1495 hopefully the test cases are okay! -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 --- Comment #6 from Jason Millard <jsm174(a)gmail.com> --- I see the test case I made failed: run.c:1927: Error in line 1568: 0 L"This array is fixed or temporarily locked: 'x'" run.c:1941: Test failed: unexpected call OnScriptError run.c:1927: Error in line 1568: 0 L"This array is fixed or temporarily locked: 'x'" run.c:1941: Test failed: unexpected call OnScriptError https://testbot.winehq.org/JobDetails.pl?Key=126628&f404=exe32.report#k401 I'm a little confused as it seems to have worked for some of the other jobs? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 --- Comment #7 from Nikolay Sivov <bunglehead(a)gmail.com> --- Hi, this is about dim rx(4) that creates a fixed array that you can't redim later. I posted a fix https://gitlab.winehq.org/wine/wine/-/merge_requests/1512. Please run your tests on Windows next time, as well as on Wine. For wine we'll need this restriction to be implemented as well. I suspect it's using FADF_FIXEDSIZE flag for it, and then Redim fails with oleaut32 API. This needs tests on its own of course. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED Fixed by SHA1| |393f740bb70b90171511e067520 | |a674fc63de19d --- Comment #8 from Nikolay Sivov <bunglehead(a)gmail.com> --- Marking fixed, with 393f740bb70b90171511e067520a674fc63de19d. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 --- Comment #9 from Jason Millard <jsm174(a)gmail.com> --- (In reply to Nikolay Sivov from comment #8)
Marking fixed, with 393f740bb70b90171511e067520a674fc63de19d.
Thanks again. Yes, sorry about that. It looks liked I changed the test case from the original code I tested in Windows. I will definitely test in Windows prior to future MRs. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 --- Comment #10 from Nikolay Sivov <bunglehead(a)gmail.com> --- I've opened another report bug 53964, to make interpreter fail properly on fixed size arrays. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #11 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 7.22. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 Michael Stefaniuc <mstefani(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |7.0.x -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=53807 Michael Stefaniuc <mstefani(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|7.0.x |--- --- Comment #12 from Michael Stefaniuc <mstefani(a)winehq.org> --- Drop 7.0.x target milestone from bugs that didn't make it. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla