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

crash if vector is mutated while iterating #2015

Closed
brson opened this issue Mar 16, 2012 · 1 comment
Closed

crash if vector is mutated while iterating #2015

brson opened this issue Mar 16, 2012 · 1 comment
Labels
A-typesystem Area: The type system

Comments

@brson
Copy link
Contributor

brson commented Mar 16, 2012

fn main() {                                                                                                                                                    
    let mut a = [0, 1, 2, 3];                                                                                                                                  
    let b = vec::filter(a) {|c|                                                                                                                                
        a = [];                                                                                                                                                
        true                                                                                                                                                   
    };                                                                                                                                                         
}  
==18087== Thread 8:
==18087== Invalid read of size 8
==18087==    at 0x4012C6: vec::filter1::_6a4a1114ba818cf3 (in /home/banderson/Dev/rust2/build/x86_64-unknown-linux-gnu/test/run-pass/test.stage1-x86_64-unknown-linux-gnu)
==18087==    by 0x400FBE: main::_843f8e32b1779b32 (in /home/banderson/Dev/rust2/build/x86_64-unknown-linux-gnu/test/run-pass/test.stage1-x86_64-unknown-linux-gnu)
==18087==    by 0x4010E9: _rust_main (in /home/banderson/Dev/rust2/build/x86_64-unknown-linux-gnu/test/run-pass/test.stage1-x86_64-unknown-linux-gnu)
==18087==    by 0x54C3E3A: task_start_wrapper(spawn_args*) (rust_task.cpp:176)
==18087==  Address 0x67ec620 is 16 bytes inside a block of size 48 free'd
==18087==    at 0x4C282ED: free (vg_replace_malloc.c:366)
==18087==    by 0x54D82B8: ??? (in /home/banderson/Dev/rust2/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so)
==18087== 

@nikomatsakis
Copy link
Contributor

I believe this is a duplicate of #1925.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system
Projects
None yet
Development

No branches or pull requests

2 participants