Bug 17247 – std.bitmanip.read should not assume sliceable range is assign-copyable to ubyte[].

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-03-08T19:12:12Z
Last change time
2018-01-05T13:27:36Z
Keywords
pull
Assigned to
No Owner
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2017-03-08T19:12:12Z
std.bitmanip.read wrongly assumes that if an input range has elements that are implicitly convertible to const(ubyte), and it supports slicing operations, then it is possible to copy range elements to a ubyte[] static array using the assignment operator. Obviously this only works if the range is ubyte[] or a similar built-in type, but it fails horribly for user-defined ubyte ranges that support slicing.
Comment #1 by hsteoh — 2017-03-08T19:13:32Z
In other words, std.bitmanip.read should not assume that slicing a ubyte range will return ubyte[] or similar, since it could be a user-defined type.
Comment #2 by hsteoh — 2017-03-08T19:39:19Z
Comment #3 by github-bugzilla — 2017-03-08T21:44:17Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/6111a6cb377279912f47bf3e50846715006a9510 Fix issue 17247. https://github.com/dlang/phobos/commit/a312a6a3fbd42442ece375ce95e36da25264b623 Merge pull request #5257 from quickfur/issue17247 Fix issue 17247: std.bitmanip.read should not assume hasSlicing means assign-copyable
Comment #4 by github-bugzilla — 2017-03-22T12:22:30Z
Comment #5 by github-bugzilla — 2017-08-07T12:26:19Z
Comment #6 by github-bugzilla — 2018-01-05T13:27:36Z