diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-01-29 22:33:33 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-01-29 22:35:24 +0000 |
| commit | 030740d3c905e1e13c58e5e45f698ae2f9513ba1 (patch) | |
| tree | 924602cd371eb95c237197ebc397362563686c6a /test | |
| parent | eb88d114acaf095ff49d83f4fcaa28d824fb3b14 (diff) | |
Fix crash on malformed SubRip file (dcpomatic #1454).
Diffstat (limited to 'test')
| -rw-r--r-- | test/subrip_reader_test.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/subrip_reader_test.cc b/test/subrip_reader_test.cc index 604f52a..283b607 100644 --- a/test/subrip_reader_test.cc +++ b/test/subrip_reader_test.cc @@ -20,6 +20,7 @@ #include "subrip_reader.h" #include "subtitle.h" #include "test.h" +#include "exceptions.h" #include "collect.h" #include <boost/test/unit_test.hpp> #include <boost/filesystem.hpp> @@ -372,6 +373,20 @@ test (boost::filesystem::path p) fclose (f); } +static void +test_throw (boost::filesystem::path p) +{ + p = private_test / p; + FILE* f = fopen (p.string().c_str(), "r"); + BOOST_CHECK (f); + if (!f) { + cerr << p << " not found.\n"; + return; + } + BOOST_CHECK_THROW (sub::SubripReader r(f), sub::SubripError); + fclose (f); +} + /** Test of reading some typical .srt files */ BOOST_AUTO_TEST_CASE (subrip_read_test) { @@ -380,6 +395,7 @@ BOOST_AUTO_TEST_CASE (subrip_read_test) test ("Fight.Club.1999.720p.BRRip.x264-x0r.srt"); test ("EU13.srt"); test ("Subtitulos_HURTO_eng.srt"); + test_throw ("subtitulo1.srt"); } #define SUB_START(f, t) \ |
