SIGSEGV - ~NonSharedCharacterBreakIterator (#1006539, webkit#101337)

This commit is contained in:
Rex Dieter 2013-09-12 11:15:40 -05:00
parent 7da03a3caa
commit 8f60fcf973
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,47 @@
diff --git a/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp b/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
index 0d9d48d..0917b03 100644
--- a/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
+++ b/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
@@ -25,6 +25,7 @@
#include <algorithm>
#include <qdebug.h>
#include <wtf/Atomics.h>
+#include <QMutex>
// #define DEBUG_TEXT_ITERATORS
#ifdef DEBUG_TEXT_ITERATORS
@@ -70,10 +71,24 @@ namespace WebCore {
static TextBreakIterator* nonSharedCharacterBreakIterator;
+ static inline bool compareAndSwapNonSharedCharacterBreakIterator(TextBreakIterator* expected, TextBreakIterator* newValue)
+ {
+#if ENABLE(COMPARE_AND_SWAP)
+ return weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), expected, newValue);
+#else
+ DEFINE_STATIC_LOCAL(QMutex, nonSharedCharacterBreakIteratorMutex, ());
+ QMutexLocker locker(&nonSharedCharacterBreakIteratorMutex);
+ if (nonSharedCharacterBreakIterator != expected)
+ return false;
+ nonSharedCharacterBreakIterator = newValue;
+ return true;
+#endif
+ }
+
NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* buffer, int length)
{
m_iterator = nonSharedCharacterBreakIterator;
- bool createdIterator = m_iterator && weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), m_iterator, 0);
+ bool createdIterator = m_iterator && compareAndSwapNonSharedCharacterBreakIterator(m_iterator, 0);
if (!createdIterator)
m_iterator = new TextBreakIterator();
if (!setUpIterator(*m_iterator, QTextBoundaryFinder::Grapheme, buffer, length)) {
@@ -84,7 +99,7 @@ namespace WebCore {
NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator()
{
- if (!weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), 0, m_iterator))
+ if (!compareAndSwapNonSharedCharacterBreakIterator(0, m_iterator))
delete m_iterator;
}

View File

@ -3,7 +3,7 @@ Name: qtwebkit
Summary: Qt WebKit bindings
Version: 2.3.2
Release: 2%{?dist}
Release: 3%{?dist}
License: LGPLv2 with exceptions or GPLv3 with exceptions
URL: http://trac.webkit.org/wiki/QtWebKit
@ -43,6 +43,10 @@ Patch10: qtwebkit-ppc.patch
Patch11: qtwebkit-23-LLInt-C-Loop-backend-ppc.patch
## upstream patches
# NonSharedCharacterBreakIterator leads to CRASH() in configurations that do not have COMPARE_AND_SWAP enabled
# http://bugs.webkit.org/show_bug.cgi?id=101337
# https://bugzilla.redhat.com/show_bug.cgi?id=1006539
Patch100: qtwebkit-webkit101337.patch
BuildRequires: bison
BuildRequires: chrpath
@ -101,6 +105,7 @@ Provides: qt4-webkit-devel%{?_isa} = 2:%{version}-%{release}
%patch10 -p1 -b .system-malloc
%patch11 -p1 -b .Double2Ints
%endif
%patch100 -p1 -b .webkit101337
%build
@ -154,6 +159,9 @@ popd
%changelog
* Thu Sep 12 2013 Rex Dieter <rdieter@fedoraproject.org> 2.3.2-3
- SIGSEGV - ~NonSharedCharacterBreakIterator (#1006539, webkit#101337)
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild