diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-07-04 17:12:47 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-07-04 17:12:47 +0900 |
| commit | 472847adc24f10e30ef5ff09814cf12d6a3d372a (patch) | |
| tree | d6e03705349448682b17c2acd13457d2fc508ac5 | |
| parent | f141ae42c0ad52ef37694ae195f5841ea2678b4f (diff) | |
| download | mruby-472847adc24f10e30ef5ff09814cf12d6a3d372a.tar.gz mruby-472847adc24f10e30ef5ff09814cf12d6a3d372a.zip | |
input cast to unsigned char for unqualified tolower(); close #342
| -rw-r--r-- | src/codegen.c | 5 | ||||
| -rw-r--r-- | src/parse.y | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/codegen.c b/src/codegen.c index 2654fcbe3..8aef2a328 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -802,8 +802,9 @@ readint_float(codegen_scope *s, const char *p, int base) mrb_float f = 0; int n; - while (p <= e) { - char c = tolower(*p); + while (p < e) { + char c = *p; + c = tolower((unsigned char)c); for (n=0; n<base; n++) { if (mrb_digitmap[n] == c) { f *= base; diff --git a/src/parse.y b/src/parse.y index 025707670..af91f09b6 100644 --- a/src/parse.y +++ b/src/parse.y @@ -3949,7 +3949,7 @@ parser_yylex(parser_state *p) } if (!ISXDIGIT(c)) break; nondigit = 0; - tokadd(p, c); + tokadd(p, tolower(c)); } while ((c = nextc(p)) != -1); } pushback(p, c); |
