mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* object.c (rb_str_to_dbl): RString ptr might be NULL.
* object.c (rb_cstr_to_dbl): p pointer might be NULL. * bignum.c (rb_str_to_inum): RString ptr might be NULL. * bignum.c (rb_cstr_to_inum): str pointer might be NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e6c0ea3e09
commit
66d1582c07
6 changed files with 59 additions and 23 deletions
17
ChangeLog
17
ChangeLog
|
@ -17,11 +17,28 @@ Wed Oct 16 13:36:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
|||
|
||||
* variable.c (rb_alias_variable): ditto.
|
||||
|
||||
Wed Oct 16 01:03:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* object.c (rb_str_to_dbl): RString ptr might be NULL.
|
||||
|
||||
* object.c (rb_cstr_to_dbl): p pointer might be NULL.
|
||||
|
||||
* bignum.c (rb_str_to_inum): RString ptr might be NULL.
|
||||
|
||||
* bignum.c (rb_cstr_to_inum): str pointer might be NULL.
|
||||
|
||||
Sat Oct 12 23:44:11 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* win32/win32.c (rb_w32_putc): wrong condition to fill or flush on
|
||||
bccwin32. [ruby-win32:408]
|
||||
|
||||
Fri Oct 11 15:58:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* parse.y (arg): rescue modifier is now an operator with
|
||||
precedence right below assignments. i.e. "a = b rescue c" now
|
||||
parsed as "a = (b rescue c)", not as "(a = b) rescue c". [new]
|
||||
[experimental]
|
||||
|
||||
Fri Oct 11 06:05:30 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* win32/win32.c (rb_w32_fclose, rb_w32_close): use closesocket()
|
||||
|
|
24
bignum.c
24
bignum.c
|
@ -319,6 +319,10 @@ rb_cstr_to_inum(str, base, badcheck)
|
|||
VALUE z;
|
||||
BDIGIT *zds;
|
||||
|
||||
if (!str) {
|
||||
if (badcheck) goto bad;
|
||||
return INT2FIX(0);
|
||||
}
|
||||
if (badcheck) {
|
||||
while (ISSPACE(*str)) str++;
|
||||
}
|
||||
|
@ -501,16 +505,18 @@ rb_str_to_inum(str, base, badcheck)
|
|||
|
||||
StringValue(str);
|
||||
s = RSTRING(str)->ptr;
|
||||
len = RSTRING(str)->len;
|
||||
if (s[len]) { /* no sentinel somehow */
|
||||
char *p = ALLOCA_N(char, len+1);
|
||||
if (s) {
|
||||
len = RSTRING(str)->len;
|
||||
if (s[len]) { /* no sentinel somehow */
|
||||
char *p = ALLOCA_N(char, len+1);
|
||||
|
||||
MEMCPY(p, s, char, len);
|
||||
p[len] = '\0';
|
||||
s = p;
|
||||
}
|
||||
if (badcheck && len != strlen(s)) {
|
||||
rb_raise(rb_eArgError, "string for Integer contains null byte");
|
||||
MEMCPY(p, s, char, len);
|
||||
p[len] = '\0';
|
||||
s = p;
|
||||
}
|
||||
if (badcheck && len != strlen(s)) {
|
||||
rb_raise(rb_eArgError, "string for Integer contains null byte");
|
||||
}
|
||||
}
|
||||
return rb_cstr_to_inum(s, base, badcheck);
|
||||
}
|
||||
|
|
2
gc.c
2
gc.c
|
@ -991,7 +991,7 @@ gc_sweep()
|
|||
}
|
||||
}
|
||||
}
|
||||
for (i = j = 0; j < heaps_used; i++) {
|
||||
for (i = j = 1; j < heaps_used; i++) {
|
||||
if (heaps_limits[i] == 0) {
|
||||
free(heaps[i]);
|
||||
heaps_used--;
|
||||
|
|
|
@ -476,6 +476,11 @@ All arguments named KEY is case-insensitive.
|
|||
: self[ key ] = val
|
||||
sets the header field corresponding to the case-insensitive key.
|
||||
|
||||
: fetch( key [,default] )
|
||||
|
||||
returns the header field corresponding to the case-insensitive key.
|
||||
returns the default value if there's no header field named key.
|
||||
|
||||
: key?( key )
|
||||
true if key exists.
|
||||
KEY is case insensitive.
|
||||
|
@ -923,6 +928,10 @@ module Net
|
|||
@header.delete key.downcase
|
||||
end
|
||||
|
||||
def fetch(*args)
|
||||
@header.fetch(*args)
|
||||
end
|
||||
|
||||
def key?( key )
|
||||
@header.key? key.downcase
|
||||
end
|
||||
|
|
19
object.c
19
object.c
|
@ -1031,6 +1031,7 @@ rb_cstr_to_dbl(p, badcheck)
|
|||
char *end;
|
||||
double d;
|
||||
|
||||
if (!p) return 0.0;
|
||||
q = p;
|
||||
if (badcheck) {
|
||||
while (ISSPACE(*p)) p++;
|
||||
|
@ -1093,15 +1094,17 @@ rb_str_to_dbl(str, badcheck)
|
|||
StringValue(str);
|
||||
s = RSTRING(str)->ptr;
|
||||
len = RSTRING(str)->len;
|
||||
if (s[len]) { /* no sentinel somehow */
|
||||
char *p = ALLOCA_N(char, len+1);
|
||||
if (s) {
|
||||
if (s[len]) { /* no sentinel somehow */
|
||||
char *p = ALLOCA_N(char, len+1);
|
||||
|
||||
MEMCPY(p, s, char, len);
|
||||
p[len] = '\0';
|
||||
s = p;
|
||||
}
|
||||
if (badcheck && len != strlen(s)) {
|
||||
rb_raise(rb_eArgError, "string for Float contains null byte");
|
||||
MEMCPY(p, s, char, len);
|
||||
p[len] = '\0';
|
||||
s = p;
|
||||
}
|
||||
if (badcheck && len != strlen(s)) {
|
||||
rb_raise(rb_eArgError, "string for Float contains null byte");
|
||||
}
|
||||
}
|
||||
return rb_cstr_to_dbl(s, badcheck);
|
||||
}
|
||||
|
|
11
parse.y
11
parse.y
|
@ -282,11 +282,12 @@ static void top_local_setup();
|
|||
* precedence table
|
||||
*/
|
||||
|
||||
%left kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD kRESCUE_MOD
|
||||
%left kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
|
||||
%left kOR kAND
|
||||
%right kNOT
|
||||
%nonassoc kDEFINED
|
||||
%right '=' tOP_ASGN
|
||||
%left kRESCUE_MOD
|
||||
%right '?' ':'
|
||||
%nonassoc tDOT2 tDOT3
|
||||
%left tOROP
|
||||
|
@ -423,10 +424,6 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
|||
$$ = NEW_UNTIL(cond($3), $1, 1);
|
||||
}
|
||||
}
|
||||
| stmt kRESCUE_MOD stmt
|
||||
{
|
||||
$$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0);
|
||||
}
|
||||
| klBEGIN
|
||||
{
|
||||
if (in_def || in_single) {
|
||||
|
@ -1039,6 +1036,10 @@ arg : lhs '=' arg
|
|||
{
|
||||
$$ = logop(NODE_OR, $1, $3);
|
||||
}
|
||||
| arg kRESCUE_MOD arg
|
||||
{
|
||||
$$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0);
|
||||
}
|
||||
| kDEFINED opt_nl {in_defined = 1;} arg
|
||||
{
|
||||
in_defined = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue