digitalmars.D.bugs - [Issue 20872] New: std.array.assocArray trusts user-provided 'front'
- d-bugmail puremagic.com (44/44) May 28 2020 https://issues.dlang.org/show_bug.cgi?id=20872
https://issues.dlang.org/show_bug.cgi?id=20872 Issue ID: 20872 Summary: std.array.assocArray trusts user-provided 'front' for values Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Keywords: safe Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: pro.mathias.lang gmail.com ``` import std.array; struct KeyRange { safe: string front () const { return null; } void popFront() {} bool empty() const { return false; } } struct ValueRange { string front () const system { int* ptr = cast(int*)42; *ptr = 42; return null; } safe: void popFront() {} bool empty() const { return false; } } void main () safe { KeyRange keys; ValueRange values; auto ret = assocArray(keys, values); } ``` ``` % dmd -preview=dip1000 -run foo.d Error: program killed by signal 11 ``` --
May 28 2020