changeset 37161:6d654ac9201e

Better handling of out-of-range subtitle timestamps. Fixes decoding of PGS subtitles.
author reimar
date Sat, 23 Aug 2014 14:23:37 +0000
parents bb15cab6c059
children b25434b964e0
files sub/av_sub.c sub/spudec.c
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sub/av_sub.c	Sat Aug 23 13:59:32 2014 +0000
+++ b/sub/av_sub.c	Sat Aug 23 14:23:37 2014 +0000
@@ -130,7 +130,7 @@
     if (res < 0)
         return res;
     if (*pts != MP_NOPTS_VALUE) {
-        if (sub.end_display_time > sub.start_display_time)
+        if (sub.end_display_time > sub.start_display_time && sub.end_display_time < 0x7fffffff)
             *endpts = *pts + sub.end_display_time / 1000.0;
         *pts += sub.start_display_time / 1000.0;
     }
--- a/sub/spudec.c	Sat Aug 23 13:59:32 2014 +0000
+++ b/sub/spudec.c	Sat Aug 23 14:23:37 2014 +0000
@@ -1426,9 +1426,9 @@
 {
   packet->start_pts = 0;
   packet->end_pts = 0x7fffffff;
-  if (pts != MP_NOPTS_VALUE)
+  if (pts != MP_NOPTS_VALUE && pts < 0xffffffffu / 90000)
     packet->start_pts = pts * 90000;
-  if (endpts != MP_NOPTS_VALUE)
+  if (endpts != MP_NOPTS_VALUE && endpts < 0xffffffffu / 90000)
     packet->end_pts = endpts * 90000;
   spudec_queue_packet(spu, packet);
 }