www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11600] New: to!BigInt(string) accepts non-numeric input

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11600

           Summary: to!BigInt(string) accepts non-numeric input
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: supernova2003dh yahoo.com


--- Comment #0 from supernova2003dh yahoo.com 2013-11-25 00:11:13 PST ---
The function to!BigInt(string) accepts non-numeric input like "avadakedavra"
without throwing an exception.

Expected result:

An exception is thrown.

Actual result:

No exception is thrown, and the BigInt is initialized.

This violates the principle of least astonishment.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 25 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11600



--- Comment #1 from hsteoh quickfur.ath.cx 2013-11-27 18:25:10 PST ---
Wow, this is bad. The BigInt implementation doesn't even check if the given
string contains digits, it just *assumes* anything that isn't '_' is an ASCII
digit, and simply subtracts '0' from it and treats the result as a decimal
value.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11600


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from hsteoh quickfur.ath.cx 2013-11-27 18:51:35 PST ---
https://github.com/D-Programming-Language/phobos/pull/1731

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11600



--- Comment #3 from supernova2003dh yahoo.com 2013-11-30 12:28:14 PST ---
Fixed by https://github.com/D-Programming-Language/phobos/pull/1731

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11600



--- Comment #4 from github-bugzilla puremagic.com 2013-12-03 17:13:35 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/1945bcacf8aaac4ad17d0184181ef72ff9bdec12
Fix issue 11600: to!BigInt(string) should validate input.

https://github.com/D-Programming-Language/phobos/commit/04c43ce00b5e0fff4742af9abe415dd028d24792
Merge pull request #1731 from quickfur/issue11600

Fix issue 11600: to!BigInt(string) should validate input.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 03 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11600


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #5 from hsteoh quickfur.ath.cx 2013-12-04 09:37:58 PST ---
Confirmed fixed in git HEAD.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 04 2013