Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
2edfc49b
Commit
2edfc49b
authored
Jul 03, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix crash in setitem rewrite path
mp_ass_subscript could become NULL and we would have crashed
parent
20cb1ccb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+6
-8
No files found.
src/runtime/objmodel.cpp
View file @
2edfc49b
...
...
@@ -6428,12 +6428,6 @@ extern "C" Box* getitem_capi(Box* target, Box* slice) noexcept {
return
rtn
;
}
static
void
setitemHelper
(
Box
*
target
,
Box
*
slice
,
Box
*
value
)
{
int
ret
=
target
->
cls
->
tp_as_mapping
->
mp_ass_subscript
(
target
,
slice
,
value
);
if
(
ret
==
-
1
)
throwCAPIException
();
}
// target[slice] = value
extern
"C"
void
setitem
(
Box
*
target
,
Box
*
slice
,
Box
*
value
)
{
STAT_TIMER
(
t0
,
"us_timer_slowpath_setitem"
,
10
);
...
...
@@ -6456,11 +6450,15 @@ extern "C" void setitem(Box* target, Box* slice, Box* value) {
RewriterVar
*
r_cls
=
r_obj
->
getAttr
(
offsetof
(
Box
,
cls
));
RewriterVar
*
r_m
=
r_cls
->
getAttr
(
offsetof
(
BoxedClass
,
tp_as_mapping
));
r_m
->
addGuardNotEq
(
0
);
rewriter
->
call
(
true
,
(
void
*
)
setitemHelper
,
r_obj
,
r_slice
,
r_value
);
r_m
->
addAttrGuard
(
offsetof
(
PyMappingMethods
,
mp_ass_subscript
),
(
intptr_t
)
m
->
mp_ass_subscript
);
RewriterVar
*
r_ret
=
rewriter
->
call
(
true
,
(
void
*
)
m
->
mp_ass_subscript
,
r_obj
,
r_slice
,
r_value
);
rewriter
->
checkAndThrowCAPIException
(
r_ret
,
-
1
,
assembler
::
MovType
::
L
);
rewriter
->
commit
();
}
setitemHelper
(
target
,
slice
,
value
);
int
ret
=
m
->
mp_ass_subscript
(
target
,
slice
,
value
);
if
(
ret
==
-
1
)
throwCAPIException
();
return
;
}
...
...
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