var YAHOO = {'Shortcuts' : {}};
YAHOO.Shortcuts.hasSensitiveText = false;
YAHOO.Shortcuts.sensitivityType = [];
YAHOO.Shortcuts.doUlt = false;
YAHOO.Shortcuts.location = "us";
YAHOO.Shortcuts.document_id = 0;
YAHOO.Shortcuts.document_type = "";
YAHOO.Shortcuts.document_title = "Bug report: strtol conversion";
YAHOO.Shortcuts.document_publish_date = "";
YAHOO.Shortcuts.document_author = "[EMAIL PROTECTED]";
YAHOO.Shortcuts.document_url = "";
YAHOO.Shortcuts.document_tags = "";
YAHOO.Shortcuts.annotationSet = {

};
<!-- DIV {margin:0px;}-->Hi,

I believe I have found a bug in the current uclibc implementation
of strtol (and friends).

An example failing program is:
assert(strtol("+2``2`4", 0, 10) == 2);

The problem is that uclibc is treating the characters '`' as the digit 9. The 
bug 
is in the vicinity of stdlib.c:561 (and 712), in the digit computation:

--
            digit = (((Wuchar)(*str - '0')) <= 9)
                ? (*str - '0')
                : (((*str) >= 'A')
                   ? (((0x20|(*str)) - 'a' + 10)) /* WARNING: assumes ascii. */
                      : 40);
--

I do not know what the preferred fix is, but I have verified that the following 
code at
least correctly computes digits for base 10.

--
            digit = (((Wuchar)(*str - '0')) <= 9)
                ? (*str - '0')
                : (((0x20|(*str)) >= 'A')
                   ? (((0x20|(*str)) - 'a' + 10)) /* WARNING: assumes ascii. */
                      : 40);
--

 - Daniel








_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to