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

type system allows setting a non-optional pointer to null via only implicit casts #1102

Closed
andrewrk opened this Issue Jun 12, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@andrewrk
Member

andrewrk commented Jun 12, 2018

after 6edd811 this is possible:

test "oaeu" {
    var x: i32 = 1234;
    var p: *i32 = &x;
    var pp: *?*i32 = &p;
    pp.* = null;
    var y = p.*;
}

it segfaults using only implicit casts, which shouldn't be possible.

runtime-assignable casting (e.g. const, volatile, and equivalent) for optional pointers should be disallowed for mutable pointer parent types. Then var pp: *?*i32 = &p; would be a compile error.

@andrewrk andrewrk added the bug label Jun 12, 2018

@andrewrk andrewrk added this to the 0.3.0 milestone Jun 12, 2018

@andrewrk andrewrk closed this in 8dd2479 Jun 13, 2018

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