Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 250895 Details for
Bug 306479
dev-libs/libxml2 segfault
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to a potential segfault due to weak symbols on pthreads
libxml2-2.7.7-fix-weak-symbols.patch (text/plain), 1.99 KB, created by
Christoph Junghans (RETIRED)
on 2010-10-16 16:40:05 UTC
(
hide
)
Description:
patch to a potential segfault due to weak symbols on pthreads
Filename:
MIME Type:
Creator:
Christoph Junghans (RETIRED)
Created:
2010-10-16 16:40:05 UTC
Size:
1.99 KB
patch
obsolete
>From e6f05099e8de3c89201aa92c5d6f0286b9299522 Mon Sep 17 00:00:00 2001 >From: Mike Hommey <mh@glandium.org> >Date: Fri, 15 Oct 2010 17:50:03 +0000 >Subject: Fix a potential segfault due to weak symbols on pthreads > >In xmlInitParser, both __xmlGlobalInitMutexLock and xmlInitGlobals are >called before xmlInitThreads, and both use pthread symbols. >__xmlGlobalInitMutexLock does so directly, without checking if the symbol >exists, and xmlInitGlobals calls xmlNewMutex, which correctly depends on >libxml_is_threaded... except libxml_is_threaded is still -1 by then... >And again, when releasing the global mutex in __xmlGlobalInitMutexUnlock, >the pthread function is called directly. > >The patch changes the initialization order and make sure the functions >are available before calling them >--- >diff --git a/parser.c b/parser.c >index 85e7599..1db706b 100644 >--- a/parser.c >+++ b/parser.c >@@ -14004,8 +14004,8 @@ xmlInitParser(void) { > __xmlGlobalInitMutexLock(); > if (xmlParserInitialized == 0) { > #endif >- xmlInitGlobals(); > xmlInitThreads(); >+ xmlInitGlobals(); > if ((xmlGenericError == xmlGenericErrorDefaultFunc) || > (xmlGenericError == NULL)) > initGenericErrorDefaultFunc(NULL); >diff --git a/threads.c b/threads.c >index 98fd2c2..1eeac0e 100644 >--- a/threads.c >+++ b/threads.c >@@ -439,7 +439,8 @@ __xmlGlobalInitMutexLock(void) > /* Make sure the global init lock is initialized and then lock it. */ > #ifdef HAVE_PTHREAD_H > /* The mutex is statically initialized, so we just lock it. */ >- pthread_mutex_lock(&global_init_lock); >+ if (pthread_mutex_lock) >+ pthread_mutex_lock(&global_init_lock); > #elif defined HAVE_WIN32_THREADS > LPCRITICAL_SECTION cs; > >@@ -508,7 +509,8 @@ void > __xmlGlobalInitMutexUnlock(void) > { > #ifdef HAVE_PTHREAD_H >- pthread_mutex_unlock(&global_init_lock); >+ if (pthread_mutex_unlock) >+ pthread_mutex_unlock(&global_init_lock); > #elif defined HAVE_WIN32_THREADS > if (global_init_lock != NULL) { > LeaveCriticalSection(global_init_lock); >-- >cgit v0.8.3.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 306479
:
221583
|
221599
|
222469
| 250895 |
250897