diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sprintf.c | 6 |
2 files changed, 12 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Wed Dec 7 15:31:35 2005 Yukihiro Matsumoto <matz@ruby-lang.org> + + * sprintf.c (rb_str_format): integer overflow check added. + + * sprintf.c (GETASTER): ditto. + Wed Dec 7 01:02:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> * ext/tk/README.macosx-aqua: [new document] tips to avoid the known @@ -113,6 +113,9 @@ sign_bits(base, p) t = p++; \ n = 0; \ for (; p < end && ISDIGIT(*p); p++) { \ + if ((n*10) / 10 != n) { \ + rb_raise(rb_eArgError, #val " too big"); \ + } \ n = 10 * n + (*p - '0'); \ } \ if (p >= end) { \ @@ -309,6 +312,9 @@ rb_f_sprintf(argc, argv) case '5': case '6': case '7': case '8': case '9': n = 0; for (; p < end && ISDIGIT(*p); p++) { + if ((n*10) / 10 != n) { + rb_raise(rb_eArgError, "width too big"); + } n = 10 * n + (*p - '0'); } if (p >= end) { |