changeset 11276:ec45f2106ec6

* fix my 100l from before * SSA is also ASS * avoid multiple segfaults when there are more then SUB_MAX_TEXT-1 lines at the same time
author attila
date Sun, 26 Oct 2003 21:09:37 +0000
parents 3ef7b4402c6c
children fffd200d81a7
files libmpdemux/demux_mkv.cpp
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.cpp	Sun Oct 26 18:54:06 2003 +0000
+++ b/libmpdemux/demux_mkv.cpp	Sun Oct 26 21:09:37 2003 +0000
@@ -491,6 +491,12 @@
 
   line = 0;
   mkv_d->subs.lines++;
+  if (mkv_d->subs.lines> SUB_MAX_TEXT - 1 )
+  {
+  	mp_msg(MSGT_DEMUX, MSGL_WARN,"[mkv] Warning: too many sublines to render, skipping\n");
+  	mkv_d->subs.lines--;
+  	return;
+  }
   s2 = mkv_d->subs.text[mkv_d->subs.lines - 1];
   state = 0;
 
@@ -2357,10 +2363,11 @@
                                                     sizeof(mkv_sh_sub_t));
       demuxer->sub->id = track->xid;
 
-    } else if (!(strcmp(track->codec_id, MKV_S_TEXTASCII) &&
+    } else if (strcmp(track->codec_id, MKV_S_TEXTASCII) &&
                strcmp(track->codec_id, MKV_S_TEXTUTF8) && 
                strcmp(track->codec_id, MKV_S_TEXTSSA) &&
-               strcmp(track->codec_id, "S_SSA")))
+               strcmp(track->codec_id, "S_SSA") &&
+               strcmp(track->codec_id, "S_TEXT/ASS"))
       mp_msg(MSGT_DEMUX, MSGL_ERR, "[mkv] Subtitle type '%s' is not "
              "supported. Track will not be displayed.\n", track->codec_id);
     else {
@@ -2374,7 +2381,8 @@
         if (!strcmp(track->codec_id, MKV_S_TEXTUTF8))
           sub_utf8 = 1;       // Force UTF-8 conversion.
         if (!strcmp(track->codec_id, MKV_S_TEXTSSA) ||
-            !strcmp(track->codec_id, "S_SSA")) {
+            !strcmp(track->codec_id, "S_SSA") ||
+            !strcmp(track->codec_id, "S_TEXT/ASS")) {
           mkv_d->subtitle_type = MKV_SUBTYPE_SSA;
           sub_utf8 = 1;
         } else