Commit ee32521f authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

add input check to readint_float()

parent 472847ad
...@@ -802,6 +802,7 @@ readint_float(codegen_scope *s, const char *p, int base) ...@@ -802,6 +802,7 @@ readint_float(codegen_scope *s, const char *p, int base)
mrb_float f = 0; mrb_float f = 0;
int n; int n;
if (*p == '+') p++;
while (p < e) { while (p < e) {
char c = *p; char c = *p;
c = tolower((unsigned char)c); c = tolower((unsigned char)c);
...@@ -812,6 +813,9 @@ readint_float(codegen_scope *s, const char *p, int base) ...@@ -812,6 +813,9 @@ readint_float(codegen_scope *s, const char *p, int base)
break; break;
} }
} }
if (n == base) {
codegen_error(s, "malformed readint input");
}
p++; p++;
} }
return f; return f;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment