Bug 13163 – std.conv.parse misses overflow when it doesn't result in a smaller value
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-19T22:08:00Z
Last change time
2014-07-30T20:22:45Z
Keywords
pull
Assigned to
nobody
Creator
nilsbossung
Comments
Comment #0 by nilsbossung — 2014-07-19T22:08:06Z
import std.conv;
import std.exception;
void main()
{
auto s = "fff";
assertThrown!ConvOverflowException(s.parse!ubyte(16)); /* fails */
}
Pull request is on the way.
Another test case by monarchdodra showing that the overflowed value can be greater than the original (duh):
import std.conv;
import std.exception;
void main()
{
auto s = "123";
assertThrown!ConvOverflowException(s.parse!ubyte(16)); /* fails */
}
Comment #3 by github-bugzilla — 2014-07-30T20:22:44Z