changeset 11808:c4bd86214a20

Fixed the subtitle line overflowing for SSA if there were too many \N in the subs.
author mosu
date Mon, 19 Jan 2004 19:51:07 +0000
parents 9a81d7b4c0b6
children 26d4ace59761
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Mon Jan 19 19:16:10 2004 +0000
+++ b/libmpdemux/demux_mkv.c	Mon Jan 19 19:51:07 2004 +0000
@@ -2265,6 +2265,12 @@
               mkv_d->clear_subs_at[mkv_d->subs.lines++]
                 = timecode + block_duration;
               *ptr2 = '\0';
+              if (mkv_d->subs.lines >= SUB_MAX_TEXT)
+                {
+                  mp_msg (MSGT_DEMUX, MSGL_WARN, "[mkv] Warning: too many "
+                          "sublines to render, skipping\n");
+                  return;
+                }
               ptr2 = mkv_d->subs.text[mkv_d->subs.lines];
               ptr1 += 2;
             }
@@ -2282,11 +2288,15 @@
             {
               if (state == 0)  /* normal char --> newline */
                 {
-                  if (mkv_d->subs.lines == SUB_MAX_TEXT - 1)
-                    break;
                   *ptr2 = '\0';
                   mkv_d->clear_subs_at[mkv_d->subs.lines++]
                     = timecode + block_duration;
+                  if (mkv_d->subs.lines >= SUB_MAX_TEXT)
+                    {
+                      mp_msg (MSGT_DEMUX, MSGL_WARN, "[mkv] Warning: too many "
+                              "sublines to render, skipping\n");
+                      return;
+                    }
                   ptr2 = mkv_d->subs.text[mkv_d->subs.lines];
                   state = 1;
                 }