www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 207] New: isUniAlpha fails for values < 'A'

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

           Summary: isUniAlpha fails for values < 'A'
           Product: D
           Version: 0.160
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: lio lunesu.com


import std.uni;
void main() {
 isUniAlpha(' ');//crash
}

Reason:
isUniAlpha uses a binary search, with end condition "while (low<=high)", low
and high being uints. At some point the only table entry to test is [0], low
and high are both 0, mid will be 0 and since entry [0] is still not OK,
high=mid-1 => ~0.

Fix:
make low,high,end "int".
dmd\src\phobos\std\uni.c, line 461-463
    int mid;
    int low;
    int high;

(The fix was tested and works)


-- 
Jun 18 2006
next sibling parent "Lionello Lunesu" <lionello lunesu.remove.com> writes:
(it includes the fix, by the way) 
Jun 18 2006
prev sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=207


benoit tionex.de changed:

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







*** This bug has been marked as a duplicate of 202 ***


-- 
Jun 18 2006
parent "Lionello Lunesu" <lionello lunesu.remove.com> writes:
...whoops 
Jun 18 2006