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
70cd4153
Commit
70cd4153
authored
Jan 22, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Alloc vbscode_t before parsing the script.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d12de646
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
compile.c
dlls/vbscript/compile.c
+19
-10
No files found.
dlls/vbscript/compile.c
View file @
70cd4153
...
@@ -1851,16 +1851,24 @@ void release_vbscode(vbscode_t *code)
...
@@ -1851,16 +1851,24 @@ void release_vbscode(vbscode_t *code)
static
vbscode_t
*
alloc_vbscode
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
source
)
static
vbscode_t
*
alloc_vbscode
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
source
)
{
{
vbscode_t
*
ret
;
vbscode_t
*
ret
;
size_t
len
;
len
=
source
?
lstrlenW
(
source
)
:
0
;
if
(
len
>
INT32_MAX
)
return
NULL
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
if
(
!
ret
)
if
(
!
ret
)
return
NULL
;
return
NULL
;
ret
->
source
=
heap_
strdupW
(
source
);
ret
->
source
=
heap_
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
!
ret
->
source
)
{
if
(
!
ret
->
source
)
{
heap_free
(
ret
);
heap_free
(
ret
);
return
NULL
;
return
NULL
;
}
}
if
(
len
)
memcpy
(
ret
->
source
,
source
,
len
*
sizeof
(
WCHAR
));
ret
->
source
[
len
]
=
0
;
ret
->
instrs
=
heap_alloc
(
32
*
sizeof
(
instr_t
));
ret
->
instrs
=
heap_alloc
(
32
*
sizeof
(
instr_t
));
if
(
!
ret
->
instrs
)
{
if
(
!
ret
->
instrs
)
{
...
@@ -1872,8 +1880,6 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
...
@@ -1872,8 +1880,6 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
ctx
->
instr_size
=
32
;
ctx
->
instr_size
=
32
;
heap_pool_init
(
&
ret
->
heap
);
heap_pool_init
(
&
ret
->
heap
);
ret
->
option_explicit
=
ctx
->
parser
.
option_explicit
;
ret
->
main_code
.
type
=
FUNC_GLOBAL
;
ret
->
main_code
.
type
=
FUNC_GLOBAL
;
ret
->
main_code
.
code_ctx
=
ret
;
ret
->
main_code
.
code_ctx
=
ret
;
ret
->
ref
=
1
;
ret
->
ref
=
1
;
...
@@ -1899,15 +1905,16 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
...
@@ -1899,15 +1905,16 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
vbscode_t
*
code
;
vbscode_t
*
code
;
HRESULT
hres
;
HRESULT
hres
;
if
(
!
src
)
src
=
L""
;
hres
=
parse_script
(
&
ctx
.
parser
,
src
,
delimiter
,
flags
);
if
(
FAILED
(
hres
))
return
compile_error
(
script
,
hres
);
code
=
ctx
.
code
=
alloc_vbscode
(
&
ctx
,
src
);
code
=
ctx
.
code
=
alloc_vbscode
(
&
ctx
,
src
);
if
(
!
ctx
.
code
)
if
(
!
ctx
.
code
)
return
compile_error
(
script
,
E_OUTOFMEMORY
);
return
E_OUTOFMEMORY
;
hres
=
parse_script
(
&
ctx
.
parser
,
code
->
source
,
delimiter
,
flags
);
if
(
FAILED
(
hres
))
{
hres
=
compile_error
(
script
,
hres
);
release_vbscode
(
code
);
return
hres
;
}
ctx
.
func_decls
=
NULL
;
ctx
.
func_decls
=
NULL
;
ctx
.
labels
=
NULL
;
ctx
.
labels
=
NULL
;
...
@@ -1922,6 +1929,8 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
...
@@ -1922,6 +1929,8 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
}
}
ctx
.
global_consts
=
ctx
.
const_decls
;
ctx
.
global_consts
=
ctx
.
const_decls
;
code
->
option_explicit
=
ctx
.
parser
.
option_explicit
;
for
(
func_decl
=
ctx
.
func_decls
;
func_decl
;
func_decl
=
func_decl
->
next
)
{
for
(
func_decl
=
ctx
.
func_decls
;
func_decl
;
func_decl
=
func_decl
->
next
)
{
hres
=
create_function
(
&
ctx
,
func_decl
,
&
new_func
);
hres
=
create_function
(
&
ctx
,
func_decl
,
&
new_func
);
...
...
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