summaryrefslogtreecommitdiffhomepage
path: root/src/codegen.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-07-04 17:14:59 +0900
committerYukihiro Matsumoto <[email protected]>2012-07-04 17:14:59 +0900
commitee32521f908ae8f27cb38bc98aa619426704c02b (patch)
tree492c19b9ca58104553533f2da11439b2fc6917d6 /src/codegen.c
parent472847adc24f10e30ef5ff09814cf12d6a3d372a (diff)
downloadmruby-ee32521f908ae8f27cb38bc98aa619426704c02b.tar.gz
mruby-ee32521f908ae8f27cb38bc98aa619426704c02b.zip
add input check to readint_float()
Diffstat (limited to 'src/codegen.c')
-rw-r--r--src/codegen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 8aef2a328..963e94b21 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -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;