diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-12-18 11:26:43 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-12-18 11:26:43 -0200 |
| commit | 0c9080c7a9c2e0f9ee39a887bbde5385160b9747 (patch) | |
| tree | 228c4571278479593d0b34f01495504feb395a0c | |
| parent | b8fcb7b151a2eba126e042634d23834f4653f208 (diff) | |
| download | lua-0c9080c7a9c2e0f9ee39a887bbde5385160b9747.tar.gz lua-0c9080c7a9c2e0f9ee39a887bbde5385160b9747.tar.bz2 lua-0c9080c7a9c2e0f9ee39a887bbde5385160b9747.zip | |
"tonumber" goes crazy with negative numbers in other bases (not 10),
because "strtol" returns long, not unsigned long.
| -rw-r--r-- | bugs | 6 | ||||
| -rw-r--r-- | lbuiltin.c | 4 |
2 files changed, 8 insertions, 2 deletions
| @@ -52,3 +52,9 @@ of view) when functions have upvalues. | |||
| 52 | ** lstrlib.c | 52 | ** lstrlib.c |
| 53 | Tue Nov 10 17:29:36 EDT 1998 | 53 | Tue Nov 10 17:29:36 EDT 1998 |
| 54 | >> gsub/strfind do not check whether captures are properly finished. | 54 | >> gsub/strfind do not check whether captures are properly finished. |
| 55 | |||
| 56 | ** lbuiltin.c | ||
| 57 | Fri Dec 18 11:22:55 EDT 1998 | ||
| 58 | >> "tonumber" goes crazy with negative numbers in other bases (not 10), | ||
| 59 | because "strtol" returns long, not unsigned long. | ||
| 60 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.37 1998/12/15 14:59:59 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.38 1998/12/15 15:21:09 roberto Exp $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -268,7 +268,7 @@ static void luaB_tonumber (void) { | |||
| 268 | } | 268 | } |
| 269 | else { | 269 | else { |
| 270 | char *s = luaL_check_string(1); | 270 | char *s = luaL_check_string(1); |
| 271 | unsigned long n; | 271 | long n; |
| 272 | luaL_arg_check(0 <= base && base <= 36, 2, "base out of range"); | 272 | luaL_arg_check(0 <= base && base <= 36, 2, "base out of range"); |
| 273 | n = strtol(s, &s, base); | 273 | n = strtol(s, &s, base); |
| 274 | while (isspace(*s)) s++; /* skip trailing spaces */ | 274 | while (isspace(*s)) s++; /* skip trailing spaces */ |
