Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
47ecca25
Commit
47ecca25
authored
Nov 08, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Improve invalid argument checks in Right().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
51483239
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
9 deletions
+34
-9
global.c
dlls/vbscript/global.c
+13
-9
api.vbs
dlls/vbscript/tests/api.vbs
+21
-0
No files found.
dlls/vbscript/global.c
View file @
47ecca25
...
...
@@ -1348,6 +1348,19 @@ static HRESULT Global_Right(BuiltinDisp *This, VARIANT *args, unsigned args_cnt,
TRACE
(
"(%s %s)
\n
"
,
debugstr_variant
(
args
),
debugstr_variant
(
args
+
1
));
if
(
V_VT
(
args
+
1
)
==
VT_NULL
)
return
MAKE_VBSERROR
(
VBSE_ILLEGAL_NULL_USE
);
hres
=
to_int
(
args
+
1
,
&
len
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
len
<
0
)
return
MAKE_VBSERROR
(
VBSE_ILLEGAL_FUNC_CALL
);
if
(
V_VT
(
args
)
==
VT_NULL
)
return
return_null
(
res
);
if
(
V_VT
(
args
)
==
VT_BSTR
)
{
str
=
V_BSTR
(
args
);
}
else
{
...
...
@@ -1357,15 +1370,6 @@ static HRESULT Global_Right(BuiltinDisp *This, VARIANT *args, unsigned args_cnt,
str
=
conv_str
;
}
hres
=
to_int
(
args
+
1
,
&
len
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
len
<
0
)
{
FIXME
(
"len = %d
\n
"
,
len
);
return
E_FAIL
;
}
str_len
=
SysStringLen
(
str
);
if
(
len
>
str_len
)
len
=
str_len
;
...
...
dlls/vbscript/tests/api.vbs
View file @
47ecca25
...
...
@@ -842,7 +842,28 @@ TestRight "test", 0, ""
TestRight
123
,
2
,
"23"
TestRight
"test"
,
"3"
,
"est"
TestRight
123
,
"2"
,
"23"
TestRight
empty
,
0
,
""
TestRight
empty
,
1
,
""
TestRight
"test"
,
empty
,
""
TestRight
"test"
,
empty
,
""
if
isEnglishLang
then
TestRight
true
,
2
,
"ue"
call
Right
(
null
,
0
)
call
ok
(
getVT
(
Right
(
null
,
0
))
=
"VT_NULL"
,
"getVT(Right(null, 0)) = "
&
getVT
(
Right
(
null
,
0
)))
call
ok
(
getVT
(
Right
(
null
,
1
))
=
"VT_NULL"
,
"getVT(Right(null, 1)) = "
&
getVT
(
Right
(
null
,
1
)))
sub
TestRightError
()
on
error
resume
next
call
Err
.
clear
()
call
Right
(
"test"
,
-
1
)
call
ok
(
Err
.
number
=
5
,
"Err.number = "
&
Err
.
number
)
call
Err
.
clear
()
call
Right
(
null
,
-
1
)
call
ok
(
Err
.
number
=
5
,
"Err.number = "
&
Err
.
number
)
call
Err
.
clear
()
call
Right
(
"test"
,
null
)
call
ok
(
Err
.
number
=
94
,
"Err.number = "
&
Err
.
number
)
end
sub
call
TestRightError
()
Sub
TestTrim
(
str
,
exstr
)
Call
ok
(
Trim
(
str
)
=
exstr
,
"Trim("
&
str
&
") = "
&
Trim
(
str
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment