Skip to content

Commit 5a5449d

Browse files
Krzysztof Blazewiczpfalcon
authored andcommitted
extmod/modbtree: do CHECK_ERROR after __bt_seq()
In `btree_seq()`, when `__bt_seq()` gets called with invalid `flags` argument it will return `RET_ERROR` and it won't initialize `val`. If field `data` of uninitialized `val` is passed to `mp_obj_new_bytes()` it causes a segfault.
1 parent 253e1a6 commit 5a5449d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

extmod/modbtree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ STATIC mp_obj_t btree_seq(size_t n_args, const mp_obj_t *args) {
133133
}
134134

135135
int res = __bt_seq(self->db, &key, &val, flags);
136+
CHECK_ERROR(res);
136137
if (res == RET_SPECIAL) {
137138
return mp_const_none;
138139
}

0 commit comments

Comments
 (0)