於 2010年11月08日 18:06, Shyouzou Sugitani 提到:
> 
> For example, BTHmini(http://rking.pa.land.to/ukagaka/ghost_bthmini.htm) and 
> brynhild_conf(site not available?).
> 
> I found that _kawari8.so segfaults if required Saori(and its compatible) 
> module did not exist. So, you can reproduce this bug with removing dll/bln.py 
> from ninix-aya and starting 
> BleedTheFreak(http://rottenheaven.jp/ghost/toxic100322.nar).
> 
> I also found that
> "SAORI_FALLBACK_ALWAYS=0 ninix" segfaults.(default)
> "SAORI_FALLBACK_ALWAYS=1 ninix" works fine.
> 
> I think the bug is in load_library() in 
> kawari-828/build/src/saori/saori_native.cpp.

Hi Shyouzou,

Yes, just as you said. The bug is indeed in load_library().
In the non-WIN32 load_library():
...
        if (!fallback_always) {
            // SAORI_FALLBACK_ALWAYSが空でも0でもなければ、まずは試しに
dlopenしてみる。
            void* handle = ::dlopen(file.c_str(), RTLD_LAZY);
            if (handle != NULL) {
                // load, unload, requestを取り出してみる。
                void* sym_load = ::dlsym(handle, "load");
                void* sym_unload = ::dlsym(handle, "unload");
                void* sym_request = ::dlsym(handle, "request");
                if (sym_load != NULL && sym_unload != NULL &&
sym_request != NULL) {
                    do_fallback = false;
                }
            }
            ::dlclose(handle);
        }
...

It tries to dlopen ~/.ninix/ghost/BTHmini/ghost/master/saori/ki.dll but
it cannot load it because it's win32 DLL so handle is NULL. And then
dlclose(NULL) causes the crash.

So I made a patch to fix the problem. I just move that dlclose() inside
the if{}. I attach the patch in this mail. This patch does work on BTHmini.
I'll upload it very soon and will file a bug against upstream.

Thanks for your help,
Paul
--- src/saori/saori_native.cpp	2010-11-09 00:15:10.837407630 +0800
+++ src/saori/saori_native.cpp	2010-11-09 00:15:28.813738444 +0800
@@ -129,8 +129,8 @@
 		if (sym_load != NULL && sym_unload != NULL && sym_request != NULL) {
 		    do_fallback = false;
 		}
+		::dlclose(handle);
 	    }
-	    ::dlclose(handle);
 	}
 	
 	if (do_fallback) {

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to