ruby-changes:11548
From: yugui <ko1@a...>
Date: Sun, 12 Apr 2009 23:03:28 +0900 (JST)
Subject: [ruby-changes:11548] Ruby:r23180 (ruby_1_9_1): merges r22883 from trunk into ruby_1_9_1.
yugui 2009-04-12 23:02:54 +0900 (Sun, 12 Apr 2009) New Revision: 23180 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23180 Log: merges r22883 from trunk into ruby_1_9_1. -- * ext/dl/handle.c (rb_dlhandle_sym): fixed heap corruption. [ruby-core:22822] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/ext/dl/handle.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 23179) +++ ruby_1_9_1/ChangeLog (revision 23180) @@ -1,3 +1,8 @@ +Wed Mar 11 13:03:12 2009 Nobuyoshi Nakada <nobu@r...> + + * ext/dl/handle.c (rb_dlhandle_sym): fixed heap corruption. + [ruby-core:22822] + Tue Mar 10 13:45:54 2009 Nobuyoshi Nakada <nobu@r...> * win32/Makefile.sub (LDFLAGS): moved -link to TRY_LINK, LINK_SO Index: ruby_1_9_1/ext/dl/handle.c =================================================================== --- ruby_1_9_1/ext/dl/handle.c (revision 23179) +++ ruby_1_9_1/ext/dl/handle.c (revision 23180) @@ -160,6 +160,7 @@ func = dlsym(handle, name); CHECK_DLERROR; +#if defined(FUNC_STDCALL) if( !func ){ int len = strlen(name); char *name_n; @@ -167,14 +168,12 @@ { char *name_a = (char*)xmalloc(len+2); strcpy(name_a, name); + name_n = name_a; name_a[len] = 'A'; name_a[len+1] = '\0'; func = dlsym(handle, name_a); CHECK_DLERROR; - if( func ){ - xfree(name_a); - goto found; - } + if( func ) goto found; name_n = xrealloc(name_a, len+6); } #else @@ -188,7 +187,6 @@ CHECK_DLERROR; if( func ) break; } - xfree(name_n); if( func ) goto found; name_n[len-1] = 'A'; name_n[len++] = '@'; @@ -198,11 +196,13 @@ CHECK_DLERROR; if( func ) break; } - if( !func ){ - rb_raise(rb_eDLError, "unknown symbol \"%s\"", name); - } + found: + xfree(name_n); } - found: +#endif + if( !func ){ + rb_raise(rb_eDLError, "unknown symbol \"%s\"", name); + } return PTR2NUM(func); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/