author | Eric Rahm <erahm@mozilla.com> |
Mon, 15 May 2017 16:52:43 -0700 | |
changeset 358488 | cd5ae949a6b9a2b28f46e4aff033468cf91f7ae5 |
parent 358487 | 17c6f55e1bdc5c931f12c9893b76cd77ecf39918 |
child 358489 | 39a921250465a46d7466c434b5c3eca8d260caf3 |
push id | 90341 |
push user | erahm@mozilla.com |
push date | Tue, 16 May 2017 00:16:46 +0000 |
treeherder | mozilla-inbound@cd5ae949a6b9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | froydnj |
bugs | 1356025 |
milestone | 55.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
xpcom/string/nsTSubstring.cpp | file | annotate | diff | comparison | revisions | |
xpcom/string/nsTSubstring.h | file | annotate | diff | comparison | revisions |
--- a/xpcom/string/nsTSubstring.cpp +++ b/xpcom/string/nsTSubstring.cpp @@ -17,16 +17,18 @@ const nsTSubstring_CharT::size_type nsTS 2 - sizeof(nsStringBuffer)) / sizeof(nsTSubstring_CharT::char_type) - 2; #ifdef XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE nsTSubstring_CharT::nsTSubstring_CharT(char_type* aData, size_type aLength, uint32_t aFlags) : nsTStringRepr_CharT(aData, aLength, aFlags) { + MOZ_RELEASE_ASSERT(CheckCapacity(aLength), "String is too large."); + if (aFlags & F_OWNED) { STRING_STAT_INCREMENT(Adopt); MOZ_LOG_CTOR(mData, "StringAdopt", 1); } } #endif /* XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE */ /**
--- a/xpcom/string/nsTSubstring.h +++ b/xpcom/string/nsTSubstring.h @@ -1117,16 +1117,17 @@ protected: #if defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING) #define XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE nsTSubstring_CharT(char_type* aData, size_type aLength, uint32_t aFlags); #else #undef XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE nsTSubstring_CharT(char_type* aData, size_type aLength, uint32_t aFlags) : nsTStringRepr_CharT(aData, aLength, aFlags) { + MOZ_RELEASE_ASSERT(CheckCapacity(aLength), "String is too large."); } #endif /* DEBUG || FORCE_BUILD_REFCNT_LOGGING */ /** * this function releases mData and does not change the value of * any of its member variables. in other words, this function acts * like a destructor. */