Bug 15678 – BigInt("") should fail more prominently

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-02-13T02:14:32Z
Last change time
2020-03-21T03:56:41Z
Keywords
pull
Assigned to
No Owner
Creator
Ivan Kazmenko

Comments

Comment #0 by gassa — 2016-02-13T02:14:32Z
The following test program, compiled with "-boundscheck=off", writes int.max (2147483647): ----- import std.bigint, std.stdio; void main () { auto a = BigInt (""); int x = a.toInt (); writeln (x); } ----- With bounds checking enabled, it fails on line 57 of bigint.d for accessing element 0 of an empty array: core.exception.RangeError@std\bigint.d(57): Range violation The error when converting an empty string to a BigInt should be raised regardless of whether bounds checking is on.
Comment #1 by hsteoh — 2016-02-13T19:27:29Z
Comment #2 by github-bugzilla — 2016-02-25T20:49:39Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/3ad0489e36819780a5b9c8a486968f6ae2fe73d3 Merge pull request #3995 from quickfur/bigint_bounds Issue 15678: BigInt("") should not break array bounds
Comment #3 by github-bugzilla — 2016-02-28T04:44:24Z
Commit pushed to revert-3995-bigint_bounds at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/181ea47be7885ad02c7030b4c6b3c3253d8f2223 Revert "Issue 15678: BigInt("") should not break array bounds"
Comment #4 by b2.temp — 2016-02-29T23:57:29Z
The bot didn't auto close this one, maybe "fixed" or "fix" missed in the PR title.