Skip to content

Commit 73e8e49

Browse files
committed
More thorough check for interior-ness in str_from_ivec
Closes #750
1 parent 0186176 commit 73e8e49

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/rt/rust_builtin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,9 @@ str_byte_len(rust_task *task, rust_str *s)
312312
extern "C" CDECL rust_str *
313313
str_from_ivec(rust_task *task, rust_ivec *v)
314314
{
315-
uintptr_t fill = v->fill ? v->fill : v->payload.ptr->fill;
316-
void *data = v->fill ? v->payload.data : v->payload.ptr->data;
315+
bool is_interior = v->fill || !v->payload.ptr;
316+
uintptr_t fill = is_interior ? v->fill : v->payload.ptr->fill;
317+
void *data = is_interior ? v->payload.data : v->payload.ptr->data;
317318

318319
rust_str *st =
319320
vec_alloc_with_data(task,

0 commit comments

Comments
 (0)