mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (rb_big_and): convert argument using 'to_int'.
* bignum.c (rb_big_or): ditto. * bignum.c (rb_big_xor): ditto. * eval.c (rb_f_require): allow "require" on $SAFE>0, if feature name is not tainted. * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::stream): Supports StringIO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
20e165a040
commit
fc8e62d0df
7 changed files with 55 additions and 24 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,8 +1,24 @@
|
||||||
|
Fri Sep 12 12:09:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* bignum.c (rb_big_and): convert argument using 'to_int'.
|
||||||
|
|
||||||
|
* bignum.c (rb_big_or): ditto.
|
||||||
|
|
||||||
|
* bignum.c (rb_big_xor): ditto.
|
||||||
|
|
||||||
Fri Sep 11 22:06:14 2003 David Black <dblack@superlink.net>
|
Fri Sep 11 22:06:14 2003 David Black <dblack@superlink.net>
|
||||||
|
|
||||||
* lib/scanf.rb: Took out useless @matched_item variable; some small
|
* lib/scanf.rb: Took out useless @matched_item variable; some small
|
||||||
refactoring.
|
refactoring.
|
||||||
|
|
||||||
|
Thu Sep 11 08:43:44 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_f_require): allow "require" on $SAFE>0, if feature
|
||||||
|
name is not tainted.
|
||||||
|
|
||||||
|
* lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::stream):
|
||||||
|
Supports StringIO.
|
||||||
|
|
||||||
Wed Sep 10 22:47:30 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
Wed Sep 10 22:47:30 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
* ext/openssl/ossl.h: define OSSL_NO_CONF_API for win32 platform.
|
* ext/openssl/ossl.h: define OSSL_NO_CONF_API for win32 platform.
|
||||||
|
|
13
bignum.c
13
bignum.c
|
@ -1451,13 +1451,10 @@ rb_big_and(x, y)
|
||||||
long i, l1, l2;
|
long i, l1, l2;
|
||||||
char sign;
|
char sign;
|
||||||
|
|
||||||
|
y = rb_to_int(y);
|
||||||
if (FIXNUM_P(y)) {
|
if (FIXNUM_P(y)) {
|
||||||
y = rb_int2big(FIX2LONG(y));
|
y = rb_int2big(FIX2LONG(y));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Check_Type(y, T_BIGNUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!RBIGNUM(y)->sign) {
|
if (!RBIGNUM(y)->sign) {
|
||||||
y = rb_big_clone(y);
|
y = rb_big_clone(y);
|
||||||
get2comp(y, Qtrue);
|
get2comp(y, Qtrue);
|
||||||
|
@ -1502,12 +1499,10 @@ rb_big_or(x, y)
|
||||||
long i, l1, l2;
|
long i, l1, l2;
|
||||||
char sign;
|
char sign;
|
||||||
|
|
||||||
|
y = rb_to_int(y);
|
||||||
if (FIXNUM_P(y)) {
|
if (FIXNUM_P(y)) {
|
||||||
y = rb_int2big(FIX2LONG(y));
|
y = rb_int2big(FIX2LONG(y));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Check_Type(y, T_BIGNUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!RBIGNUM(y)->sign) {
|
if (!RBIGNUM(y)->sign) {
|
||||||
y = rb_big_clone(y);
|
y = rb_big_clone(y);
|
||||||
|
@ -1554,12 +1549,10 @@ rb_big_xor(x, y)
|
||||||
long i, l1, l2;
|
long i, l1, l2;
|
||||||
char sign;
|
char sign;
|
||||||
|
|
||||||
|
y = rb_to_int(y);
|
||||||
if (FIXNUM_P(y)) {
|
if (FIXNUM_P(y)) {
|
||||||
y = rb_int2big(FIX2LONG(y));
|
y = rb_int2big(FIX2LONG(y));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Check_Type(y, T_BIGNUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!RBIGNUM(y)->sign) {
|
if (!RBIGNUM(y)->sign) {
|
||||||
y = rb_big_clone(y);
|
y = rb_big_clone(y);
|
||||||
|
|
19
eval.c
19
eval.c
|
@ -133,8 +133,13 @@ rb_secure(level)
|
||||||
int level;
|
int level;
|
||||||
{
|
{
|
||||||
if (level <= ruby_safe_level) {
|
if (level <= ruby_safe_level) {
|
||||||
rb_raise(rb_eSecurityError, "Insecure operation `%s' at level %d",
|
if (ruby_frame->last_func) {
|
||||||
rb_id2name(ruby_frame->last_func), ruby_safe_level);
|
rb_raise(rb_eSecurityError, "Insecure operation `%s' at level %d",
|
||||||
|
rb_id2name(ruby_frame->last_func), ruby_safe_level);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rb_raise(rb_eSecurityError, "Insecure operation at level %d", ruby_safe_level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5923,7 +5928,10 @@ rb_f_require(obj, fname)
|
||||||
VALUE feature, tmp;
|
VALUE feature, tmp;
|
||||||
char *ext; /* OK */
|
char *ext; /* OK */
|
||||||
|
|
||||||
SafeStringValue(fname);
|
if (OBJ_TAINTED(fname)) {
|
||||||
|
rb_check_safe_obj(fname);
|
||||||
|
}
|
||||||
|
StringValue(fname);
|
||||||
ext = strrchr(RSTRING(fname)->ptr, '.');
|
ext = strrchr(RSTRING(fname)->ptr, '.');
|
||||||
if (ext && strchr(ext, '/')) ext = 0;
|
if (ext && strchr(ext, '/')) ext = 0;
|
||||||
if (ext) {
|
if (ext) {
|
||||||
|
@ -5993,15 +6001,17 @@ load_dyna(feature, fname)
|
||||||
VALUE feature, fname;
|
VALUE feature, fname;
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
|
volatile int safe = ruby_safe_level;
|
||||||
|
|
||||||
if (rb_feature_p(RSTRING(feature)->ptr, Qfalse))
|
if (rb_feature_p(RSTRING(feature)->ptr, Qfalse))
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
rb_provide_feature(feature);
|
rb_provide_feature(feature);
|
||||||
{
|
{
|
||||||
int volatile old_vmode = scope_vmode;
|
volatile int old_vmode = scope_vmode;
|
||||||
NODE *const volatile old_node = ruby_current_node;
|
NODE *const volatile old_node = ruby_current_node;
|
||||||
const volatile ID old_func = ruby_frame->last_func;
|
const volatile ID old_func = ruby_frame->last_func;
|
||||||
|
|
||||||
|
ruby_safe_level = 0;
|
||||||
ruby_current_node = 0;
|
ruby_current_node = 0;
|
||||||
ruby_sourcefile = rb_source_filename(RSTRING(fname)->ptr);
|
ruby_sourcefile = rb_source_filename(RSTRING(fname)->ptr);
|
||||||
ruby_sourceline = 0;
|
ruby_sourceline = 0;
|
||||||
|
@ -6020,6 +6030,7 @@ load_dyna(feature, fname)
|
||||||
ruby_frame->last_func = old_func;
|
ruby_frame->last_func = old_func;
|
||||||
SCOPE_SET(old_vmode);
|
SCOPE_SET(old_vmode);
|
||||||
}
|
}
|
||||||
|
ruby_safe_level = safe;
|
||||||
if (state) JUMP_TAG(state);
|
if (state) JUMP_TAG(state);
|
||||||
ruby_errinfo = Qnil;
|
ruby_errinfo = Qnil;
|
||||||
|
|
||||||
|
|
|
@ -323,11 +323,20 @@ if $getaddr_info_ok and have_func("getaddrinfo") and have_func("getnameinfo")
|
||||||
have_getaddrinfo = true
|
have_getaddrinfo = true
|
||||||
else
|
else
|
||||||
if try_link(<<EOF)
|
if try_link(<<EOF)
|
||||||
#include <sys/types.h>
|
#ifndef _WIN32
|
||||||
#include <netdb.h>
|
# include <sys/types.h>
|
||||||
#include <string.h>
|
# include <netdb.h>
|
||||||
#include <sys/socket.h>
|
# include <string.h>
|
||||||
#include <netinet/in.h>
|
# include <sys/socket.h>
|
||||||
|
# include <netinet/in.h>
|
||||||
|
#else
|
||||||
|
# include <windows.h>
|
||||||
|
# ifdef _WIN32_WCE
|
||||||
|
# include <winsock.h>
|
||||||
|
# else
|
||||||
|
# include <winsock.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
|
|
@ -633,7 +633,8 @@ def dir_config(target, idefault=nil, ldefault=nil)
|
||||||
idir = with_config(target + "-include", idefault)
|
idir = with_config(target + "-include", idefault)
|
||||||
ldir = with_config(target + "-lib", ldefault)
|
ldir = with_config(target + "-lib", ldefault)
|
||||||
|
|
||||||
idirs = idir ? idir.split(File::PATH_SEPARATOR) : []
|
# idirs = idir ? idir.split(File::PATH_SEPARATOR) : []
|
||||||
|
idirs = idir.split(File::PATH_SEPARATOR) rescue []
|
||||||
if defaults
|
if defaults
|
||||||
idirs.concat(defaults.collect {|dir| dir + "/include"})
|
idirs.concat(defaults.collect {|dir| dir + "/include"})
|
||||||
idir = ([idir] + idirs).compact.join(File::PATH_SEPARATOR)
|
idir = ([idir] + idirs).compact.join(File::PATH_SEPARATOR)
|
||||||
|
|
|
@ -106,9 +106,11 @@ module REXML
|
||||||
@source = IOSource.new(source)
|
@source = IOSource.new(source)
|
||||||
elsif source.kind_of? Source
|
elsif source.kind_of? Source
|
||||||
@source = source
|
@source = source
|
||||||
|
elsif defined? StringIO and source.kind_of? StringIO
|
||||||
|
@source = IOSource.new(source)
|
||||||
else
|
else
|
||||||
raise "#{source.type} is not a valid input stream. It must be \n"+
|
raise "#{source.class} is not a valid input stream. It must be \n"+
|
||||||
"either a String, IO, or Source."
|
"either a String, IO, StringIO or Source."
|
||||||
end
|
end
|
||||||
@closed = nil
|
@closed = nil
|
||||||
@document_status = nil
|
@document_status = nil
|
||||||
|
|
|
@ -1150,8 +1150,7 @@ rb_autoload(mod, id, file)
|
||||||
struct st_table *tbl;
|
struct st_table *tbl;
|
||||||
|
|
||||||
if (!rb_is_const_id(id)) {
|
if (!rb_is_const_id(id)) {
|
||||||
rb_raise(rb_eNameError, "autoload must be constant name",
|
rb_raise(rb_eNameError, "autoload must be constant name", rb_id2name(id));
|
||||||
rb_id2name(id));
|
|
||||||
}
|
}
|
||||||
if (!file || !*file) {
|
if (!file || !*file) {
|
||||||
rb_raise(rb_eArgError, "empty file name");
|
rb_raise(rb_eArgError, "empty file name");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue