← Back to index
|
Original Bugzilla link
Bug 20872 – std.array.assocArray trusts user-provided 'front' for values
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2020-05-28T12:04:24Z
Last change time
2024-07-31T12:07:29Z
Keywords
pull, safe
Assigned to
No Owner
Creator
Mathias LANG
Comments
Comment #0
by pro.mathias.lang — 2020-05-28T12:04:24Z
``` 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 ```
Comment #1
by dlang-bot — 2024-07-31T10:41:14Z
@ntrel created dlang/phobos pull request #9036 "Fix Bugzilla 20872 - std.array.assocArray trusts user-provided 'front…" fixing this issue: - Fix Bugzilla 20872 - std.array.assocArray trusts user-provided 'front' for values
https://github.com/dlang/phobos/pull/9036
Comment #2
by dlang-bot — 2024-07-31T12:07:29Z
dlang/phobos pull request #9036 "Fix Bugzilla 20872 - std.array.assocArray trusts user-provided 'front…" was merged into master: - b9dae663f9b795f841f5e65c48ee249209663bb7 by Nick Treleaven: Fix Bugzilla 20872 - std.array.assocArray trusts user-provided 'front' for values
https://github.com/dlang/phobos/pull/9036