add input check to readint_float()

This commit is contained in:
Yukihiro Matsumoto
2012-07-04 17:14:59 +09:00
parent 472847adc2
commit ee32521f90
+4
View File
@@ -802,6 +802,7 @@ readint_float(codegen_scope *s, const char *p, int base)
mrb_float f = 0;
int n;
if (*p == '+') p++;
while (p < e) {
char c = *p;
c = tolower((unsigned char)c);
@@ -812,6 +813,9 @@ readint_float(codegen_scope *s, const char *p, int base)
break;
}
}
if (n == base) {
codegen_error(s, "malformed readint input");
}
p++;
}
return f;