Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
ff8da0b8
Commit
ff8da0b8
authored
May 31, 2014
by
Paul Sokolovsky
Browse files
vm: Detect stack underflow in addition to overflow.
parent
ae9c82d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/vm.c
View file @
ff8da0b8
...
...
@@ -158,6 +158,13 @@ mp_vm_return_kind_t mp_execute_bytecode(const byte *code, const mp_obj_t *args,
mp_vm_return_kind_t
vm_return_kind
=
mp_execute_bytecode2
(
code
,
&
ip
,
&
state
[
n_state
-
1
],
&
sp
,
exc_stack
,
&
exc_sp
,
MP_OBJ_NULL
);
#if DETECT_VM_STACK_OVERFLOW
if
(
vm_return_kind
==
MP_VM_RETURN_NORMAL
)
{
if
(
sp
!=
state
)
{
printf
(
"Stack misalign: %d
\n
"
,
sp
-
state
);
assert
(
0
);
}
}
// We can't check the case when an exception is returned in state[n_state - 1]
// and there are no arguments, because in this case our detection slot may have
// been overwritten by the returned exception (which is allowed).
...
...
Write
Preview
Supports
Markdown
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