* io.c (rb_f_backquote): need not to check nil result.

[ruby-core:02078]

* io.c (rb_io_getline): should return nil on eof, even when nil rs is
  specified. [ruby-core:02077]

* pack.c (pack_pack): add sign check for 'i', and 'l'.
  [ruby-dev:22427]

* bignum.c (rb_quad_pack): add range check for 'quad int'.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-12-26 15:34:33 +00:00
parent ab0c37d0cf
commit b9a79bc020
6 changed files with 41 additions and 20 deletions

View file

@ -203,6 +203,8 @@ rb_quad_pack(buf, val)
long len = RBIGNUM(val)->len;
BDIGIT *ds;
if (len > SIZEOF_LONG_LONG/SIZEOF_BDIGITS)
rb_raise(rb_eRangeError, "bignum too big to convert into `quad int'");
ds = BDIGITS(val);
q = 0;
while (len--) {
@ -272,7 +274,9 @@ rb_quad_pack(buf, val)
val = rb_int2big(FIX2LONG(val));
}
len = RBIGNUM(val)->len * SIZEOF_BDIGITS;
if (len > QUAD_SIZE) len = QUAD_SIZE;
if (len > QUAD_SIZE) {
rb_raise(rb_eRangeError, "bignum too big to convert into `quad int'");
}
memcpy(buf, (char*)BDIGITS(val), len);
if (!RBIGNUM(val)->sign) {
len = QUAD_SIZE;
@ -759,10 +763,10 @@ long
rb_big2long(x)
VALUE x;
{
unsigned long num = big2ulong(x, "int");
unsigned long num = big2ulong(x, "long");
if ((long)num < 0 && (RBIGNUM(x)->sign || (long)num != LONG_MIN)) {
rb_raise(rb_eRangeError, "bignum too big to convert into `int'");
rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
}
if (!RBIGNUM(x)->sign) return -(long)num;
return num;