mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
win32ole.c: check argument type
* ext/win32ole/win32ole.c (ole_vstr2wc): check argument type, vstr must be a String here. reported by Marcin 'Icewall' Noga of Cisco Talos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
207360044b
commit
739d9a37cb
3 changed files with 14 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Dec 13 18:19:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/win32ole/win32ole.c (ole_vstr2wc): check argument type, vstr
|
||||
must be a String here. reported by Marcin 'Icewall' Noga of
|
||||
Cisco Talos.
|
||||
|
||||
Sun Dec 13 16:41:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (BOOTSTRAPRUBY): make BASERUBY full path before
|
||||
|
|
|
@ -860,6 +860,11 @@ ole_vstr2wc(VALUE vstr)
|
|||
LPWSTR pw;
|
||||
st_data_t data;
|
||||
struct st_table *tbl = DATA_PTR(enc2cp_hash);
|
||||
|
||||
/* do not type-conversion here to prevent from other arguments
|
||||
* changing (if exist) */
|
||||
Check_Type(vstr, T_STRING);
|
||||
|
||||
enc = rb_enc_get(vstr);
|
||||
|
||||
if (st_lookup(tbl, (VALUE)enc | FIXNUM_FLAG, &data)) {
|
||||
|
|
|
@ -312,6 +312,9 @@ if defined?(WIN32OLE)
|
|||
assert_raise(ArgumentError) {
|
||||
shell.ole_query_interface
|
||||
}
|
||||
assert_raise(TypeError) {
|
||||
shell.ole_query_interface(0x11223344)
|
||||
}
|
||||
shell2 = shell.ole_query_interface('{A4C6892C-3BA9-11D2-9DEA-00C04FB16162}')
|
||||
assert_instance_of(WIN32OLE, shell2)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue