[Issue 207] New: isUniAlpha fails for values < 'A'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 18 11:36:22 PDT 2006


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 at digitalmars.com
        ReportedBy: lio at 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)


-- 




More information about the Digitalmars-d-bugs mailing list