Skip to content

upcall_vec_append can crash when self-appending #498

Closed
@jdm

Description

@jdm

use std;
import std::vec;

fn main()
{
let vec[int] a = [0];
auto i = 20;
while (i > 0) {
a += a;
i -= 1;
}
}

I suspect, but haven't confirmed, the following:
If a vector that is in the process of self-appending (v += v) grows, we can realloc the existing vector pointer and invalidate the memory that is being copied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions