From ba1dc0fe45d25037d8c89049a2153f1dab4313c9 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 7 Aug 2012 17:05:42 +0000 Subject: [PATCH] Add checks to CefStringBase constructors for NULL pointers (issue #671). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@733 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- include/internal/cef_string_wrappers.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/internal/cef_string_wrappers.h b/include/internal/cef_string_wrappers.h index c0507c1cc..b3012331b 100644 --- a/include/internal/cef_string_wrappers.h +++ b/include/internal/cef_string_wrappers.h @@ -314,7 +314,8 @@ class CefStringBase { } CefStringBase(const char* src) // NOLINT(runtime/explicit) : string_(NULL), owner_(false) { - FromString(std::string(src)); + if (src) + FromString(std::string(src)); } /// @@ -328,7 +329,8 @@ class CefStringBase { } CefStringBase(const wchar_t* src) // NOLINT(runtime/explicit) : string_(NULL), owner_(false) { - FromWString(std::wstring(src)); + if (src) + FromWString(std::wstring(src)); } #if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32)) @@ -343,7 +345,8 @@ class CefStringBase { } CefStringBase(const char16* src) // NOLINT(runtime/explicit) : string_(NULL), owner_(false) { - FromString16(string16(src)); + if (src) + FromString16(string16(src)); } #endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32 @@ -355,7 +358,8 @@ class CefStringBase { /// CefStringBase(const char_type* src, size_t src_len, bool copy) : string_(NULL), owner_(false) { - FromString(src, src_len, copy); + if (src && src_len > 0) + FromString(src, src_len, copy); } ///