diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-07-14 19:40:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-07-14 19:40:42 +0100 |
| commit | dd328df9676cabcf024409ab6d8521c80b4ab99c (patch) | |
| tree | d128ee9834f5caa160630529d9252d0546cc0668 /src/subrip_reader.cc | |
| parent | 77ab424993be788e056732e1878bb04fe1c74202 (diff) | |
Fix crash with unexpected <font> color formats.
Diffstat (limited to 'src/subrip_reader.cc')
| -rw-r--r-- | src/subrip_reader.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/subrip_reader.cc b/src/subrip_reader.cc index cf0b86f..cfeeade 100644 --- a/src/subrip_reader.cc +++ b/src/subrip_reader.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ #include "subrip_reader.h" #include "exceptions.h" #include "util.h" +#include "sub_assert.h" #include <boost/algorithm/string.hpp> #include <boost/lexical_cast.hpp> #include <boost/regex.hpp> @@ -241,9 +242,12 @@ SubripReader::convert_line (string t, RawSubtitle& p) if (boost::regex_search (tag, match, re) && string (match[1]).size() == 6) { p.colour = Colour::from_rgb_hex (match[1]); colours.push_back (p.colour); + } else { + throw SubripError (tag, "a colour in the format #rrggbb", _context); } } else if (tag == "/font") { maybe_content (p); + SUB_ASSERT (!colours.empty()); colours.pop_back (); p.colour = colours.back (); } |
