Fix crash on make-dcp after trimming end of text subtitles (#1275).
authorCarl Hetherington <cth@carlh.net>
Thu, 19 Apr 2018 21:51:45 +0000 (22:51 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 19 Apr 2018 21:51:45 +0000 (22:51 +0100)
ChangeLog
src/lib/player.cc

index 522e56d8a5c98d4180bc58ddf7f4cd20b90051bd..5c584e35fde38124e0bcfbc9ac81fd69e85950be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-19  Carl Hetherington  <cth@carlh.net>
+
+       * Fix crash on making a DCP after trimming the end of some text-based subtitles (#1275).
+
 2018-04-13  Carl Hetherington  <cth@carlh.net>
 
        * Fix incorrect preview crop with DCP sources when the preview is smaller than half
index 212bcfe45612f8d2264c03ebc923a7429f319507..6fcf57949d8340e1a225a4c2c7dd2f9a71546a88 100644 (file)
@@ -876,6 +876,10 @@ Player::text_subtitle_start (weak_ptr<Piece> wp, ContentTextSubtitle subtitle)
        PlayerSubtitles ps;
        DCPTime const from (content_time_to_dcp (piece, subtitle.from()));
 
+       if (from > piece->content->end()) {
+               return;
+       }
+
        BOOST_FOREACH (dcp::SubtitleString s, subtitle.subs) {
                s.set_h_position (s.h_position() + piece->content->subtitle->x_offset ());
                s.set_v_position (s.v_position() + piece->content->subtitle->y_offset ());
@@ -918,6 +922,10 @@ Player::subtitle_stop (weak_ptr<Piece> wp, ContentTime to)
 
        DCPTime const dcp_to = content_time_to_dcp (piece, to);
 
+       if (dcp_to > piece->content->end()) {
+               return;
+       }
+
        pair<PlayerSubtitles, DCPTime> from = _active_subtitles.add_to (wp, dcp_to);
 
        if (piece->content->subtitle->use() && !_always_burn_subtitles && !piece->content->subtitle->burn()) {