You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 178 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi!
the ints.c module does not check the size of digits with respect to the
chosen base:
Int64.of_string "abcd";;
: int64 = <int64 11233>
I'd like to suggest the following patch in int64_of_string:
p = parse_sign_and_base(String_val(s), &base, &sign);
for (res = 0; /nothing/; p++) {
d = parse_digit(p);
if (d < 0) break;
if (d >= base) break; /** new - check digit with respect to base **/
res = base * res + d;
}
if (*p != 0) failwith("int_of_string");
Original bug ID: 178
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi!
the ints.c module does not check the size of digits with respect to the
chosen base:
Int64.of_string "abcd";;
I'd like to suggest the following patch in int64_of_string:
p = parse_sign_and_base(String_val(s), &base, &sign);
for (res = 0; /nothing/; p++) {
d = parse_digit(p);
if (d < 0) break;
if (d >= base) break; /** new - check digit with respect to base **/
res = base * res + d;
}
if (*p != 0) failwith("int_of_string");
-- Christian
--
Christian Lindig Harvard University - EECS
lindig@eecs.harvard.edu 33 Oxford St, MD 242, Cambridge MA 02138
phone: (617) 496-7157 http://www.eecs.harvard.edu/~lindig/
The text was updated successfully, but these errors were encountered: