Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkedList corrupted in .split_off() #26021

Closed
bluss opened this issue Jun 5, 2015 · 1 comment
Closed

LinkedList corrupted in .split_off() #26021

bluss opened this issue Jun 5, 2015 · 1 comment
Labels
P-high High priority T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@bluss
Copy link
Member

bluss commented Jun 5, 2015

User seppo0010 in #rust irc found this corruption and crasher bug in LinkedList::split_off()

Exists in rustc 1.0 and nightly

(playpen link)

use std::collections::LinkedList;

fn main() {
    let mut v1 = LinkedList::new();
    v1.push_front(1u8);
    v1.push_front(1u8);
    v1.push_front(1u8);
    v1.push_front(1u8);
    let _ = v1.split_off(3);
    assert_eq!(v1.len(), 3);
    //assert_eq!(v2.len(), 1);

    println!("{}", v1.iter().len());
    println!("{}", v1.iter().collect::<Vec<_>>().len());
}

Corruption is visible when you let the split off vector drop at once.

It's too late for me to analyze this right now, but I suspect a backlink is not being updated correctly.

@alexcrichton alexcrichton added I-nominated P-high High priority T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jun 5, 2015
@Gankra
Copy link
Contributor

Gankra commented Jun 5, 2015

Found it. Missing nulling of a ptr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants