Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/String.h

Issue 29680706: Noissue - zero length OwnedString is valid. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Jan. 26, 2018, 8:33 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -290,17 +290,19 @@
}
else
mBuf = nullptr;
}
explicit OwnedString(const String& str)
: OwnedString(str.length())
{
- if (length())
+ if (!str.is_invalid() && !length())
+ mLen = length() | READ_WRITE;
+ else if (length())
std::memcpy(mBuf, str.mBuf, sizeof(value_type) * length());
}
OwnedString(const OwnedString& str)
: OwnedString(static_cast<const String&>(str))
{
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld