From de40fdd2d3c6edf65eed6f43d0d7731440bfb555 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 30 Nov 2012 17:01:47 +0100 Subject: Crash in conversion of empty OpaqueJSString to Identifier https://bugs.webkit.org/show_bug.cgi?id=101867 Patch by Allan Sandfeld Jensen on 2012-11-30 Reviewed by NOBODY (OOPS!). The constructor call used for both null and empty OpaqueJSStrings results in an assertion voilation and crash. This patch instead uses the Identifier constructors which are specifically for null and empty Identifier. * API/OpaqueJSString.cpp: (OpaqueJSString::identifier): Change-Id: Ia685336d1310be99425d1f80ec29ed0020084061 Reviewed-by: Simon Hausmann --- Source/JavaScriptCore/API/OpaqueJSString.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Source/JavaScriptCore/API/OpaqueJSString.cpp') diff --git a/Source/JavaScriptCore/API/OpaqueJSString.cpp b/Source/JavaScriptCore/API/OpaqueJSString.cpp index ac7cfd16a..90bc1c095 100644 --- a/Source/JavaScriptCore/API/OpaqueJSString.cpp +++ b/Source/JavaScriptCore/API/OpaqueJSString.cpp @@ -50,8 +50,11 @@ String OpaqueJSString::string() const Identifier OpaqueJSString::identifier(JSGlobalData* globalData) const { - if (!this || !m_string.length()) - return Identifier(globalData, static_cast(0)); + if (!this || m_string.isNull()) + return Identifier(); + + if (m_string.isEmpty()) + return Identifier(Identifier::EmptyIdentifier); if (m_string.is8Bit()) return Identifier(globalData, m_string.characters8(), m_string.length()); -- cgit v1.2.1