vttdemux::ChapterAtomParser: check for NULL display string
prevents segfault due to strlen(NULL)
BUG=webm:1382
Change-Id: I536663e287d151e11bf7074349a34d922cb9856a
diff --git a/vttdemux.cc b/vttdemux.cc
index b09a9b3..c9abd5c 100644
--- a/vttdemux.cc
+++ b/vttdemux.cc
@@ -262,6 +262,8 @@
const mkvparser::Chapters::Display* display)
: display_(display) {
str_ = display->GetString();
+ if (str_ == NULL)
+ return;
const size_t len = strlen(str_);
str_end_ = str_ + len;
}
@@ -269,7 +271,7 @@
ChapterAtomParser::~ChapterAtomParser() {}
int ChapterAtomParser::GetChar(char* c) {
- if (str_ >= str_end_) // end-of-stream
+ if (str_ == NULL || str_ >= str_end_) // end-of-stream
return 1; // per the semantics of libwebvtt::Reader::GetChar
*c = *str_++; // consume this character in the stream