Skip to content

upcall_vec_append can crash when self-appending #498

Closed
@jdm

Description

@jdm
Contributor

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.

Activity

msullivan

msullivan commented on Jun 24, 2011

@msullivan
Contributor

I'm the last person who touched the vec append glue. I'll look into it.

msullivan

msullivan commented on Jun 24, 2011

@msullivan
Contributor

Yeah, you were exactly right. Fixed by #573.

added a commit that references this issue on Dec 12, 2017

Auto merge of rust-lang#498 - learnopengles:run-ios-tests, r=alexcric…

added a commit that references this issue on Oct 23, 2018
60826e7
added a commit that references this issue on Dec 24, 2018

Auto merge of #57079 - matthiaskrgr:clippy, r=oli-obk

added a commit that references this issue on Apr 23, 2020

Merge pull request rust-lang#498 from chriskrycho/const-evaluation-467

692f694
added a commit that references this issue on Mar 7, 2023
added a commit that references this issue on Jul 10, 2024

Merge pull request rust-lang#498 from rust-lang/fix/pass-indirect-wit…

4183917
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @jdm@msullivan

        Issue actions

          upcall_vec_append can crash when self-appending · Issue #498 · rust-lang/rust