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



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




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



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




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




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


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



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