Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1979)

Unified Diff: media/webm/webm_parser.cc

Issue 14299005: Add support for zero-padded strings to WebMParser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac build Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/webm/webm_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/webm/webm_parser.cc
diff --git a/media/webm/webm_parser.cc b/media/webm/webm_parser.cc
index 9952efa58c701d80814a0bb0ab8f57e84d9cff3f..fb9f8997d350cf6aaafd698fa0de9ed30d37faf7 100644
--- a/media/webm/webm_parser.cc
+++ b/media/webm/webm_parser.cc
@@ -599,7 +599,9 @@ static int ParseBinary(const uint8* buf, int size, int id,
static int ParseString(const uint8* buf, int size, int id,
WebMParserClient* client) {
- std::string str(reinterpret_cast<const char*>(buf), size);
+ const uint8* end = static_cast<const uint8*>(memchr(buf, '\0', size));
+ int length = (end != NULL) ? static_cast<int>(end - buf) : size;
+ std::string str(reinterpret_cast<const char*>(buf), length);
return client->OnString(id, str) ? size : -1;
}
« no previous file with comments | « no previous file | media/webm/webm_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698