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.
Comment #1 by nilsbossung — 2014-07-19T22:46:14Z
Comment #2 by nilsbossung — 2014-07-20T10:26:41Z
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
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/efe0d1722b0d873afc9b177edfb052c0fda4181e fix issue 13163 - std.conv.parse misses overflow when it doesn't result in a smaller value https://github.com/D-Programming-Language/phobos/commit/087b2f773274aa31da78ccd77880855c77f4353f Merge pull request #2355 from NilsBossung/13163 fix issue 13163 - std.conv.parse misses overflow when it doesn't result in a smaller value