Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
c8ee9c60
Commit
c8ee9c60
authored
Aug 11, 2011
by
Alex Brainman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: better checks for syscall.NewCallback parameter
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/4859042
parent
d118905c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
src/pkg/runtime/windows/thread.c
src/pkg/runtime/windows/thread.c
+17
-7
No files found.
src/pkg/runtime/windows/thread.c
View file @
c8ee9c60
...
...
@@ -347,16 +347,26 @@ static Callbacks cbs;
byte
*
runtime
·
compilecallback
(
Eface
fn
,
bool
cleanstack
)
{
Func
*
f
;
int32
argsize
,
n
;
FuncType
*
ft
;
Type
*
t
;
int32
argsize
,
i
,
n
;
byte
*
p
;
Callback
*
c
;
if
(
fn
.
type
->
kind
!=
KindFunc
)
runtime
·
panicstring
(
"not a function"
);
if
((
f
=
runtime
·
findfunc
((
uintptr
)
fn
.
data
))
==
nil
)
runtime
·
throw
(
"cannot find function"
);
argsize
=
(
f
->
args
-
2
)
*
4
;
if
(
fn
.
type
==
nil
||
fn
.
type
->
kind
!=
KindFunc
)
runtime
·
panicstring
(
"compilecallback: not a function"
);
ft
=
(
FuncType
*
)
fn
.
type
;
if
(
ft
->
out
.
len
!=
1
)
runtime
·
panicstring
(
"compilecallback: function must have one output parameter"
);
if
(((
Type
**
)
ft
->
out
.
array
)[
0
]
->
size
!=
sizeof
(
uintptr
))
runtime
·
panicstring
(
"compilecallback: output parameter size is wrong"
);
argsize
=
0
;
for
(
i
=
0
;
i
<
ft
->
in
.
len
;
i
++
)
{
t
=
((
Type
**
)
ft
->
in
.
array
)[
i
];
if
(
t
->
size
!=
sizeof
(
uintptr
))
runtime
·
panicstring
(
"compilecallback: input parameter size is wrong"
);
argsize
+=
t
->
size
;
}
// compute size of new fn.
// must match code laid out below.
...
...
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