summaryrefslogtreecommitdiffstats
path: root/contrib/ffmpeg
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg')
-rw-r--r--contrib/ffmpeg/A14-dvdsubdec-fix-processing-of-partial-packets.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A14-dvdsubdec-fix-processing-of-partial-packets.patch b/contrib/ffmpeg/A14-dvdsubdec-fix-processing-of-partial-packets.patch
new file mode 100644
index 000000000..dbe1d8d7c
--- /dev/null
+++ b/contrib/ffmpeg/A14-dvdsubdec-fix-processing-of-partial-packets.patch
@@ -0,0 +1,49 @@
+From b5846bbdf2bea0ec40ab68fbb5440e17a9390f65 Mon Sep 17 00:00:00 2001
+From: John Stebbins <[email protected]>
+Date: Wed, 11 Dec 2019 14:10:09 -0800
+Subject: [PATCH] dvdsubdec: fix processing of partial packets
+
+Wait for a complete dvd subtitle before processing.
+
+If the input packet is large enough to start processing, but does not
+contain complete data, unfinished results are emitted and the following
+input packet causes an error because the stream is no longer in sync
+with the decoder.
+---
+ libavcodec/dvdsubdec.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
+index 741ea9fd1e..c0c9962bad 100644
+--- a/libavcodec/dvdsubdec.c
++++ b/libavcodec/dvdsubdec.c
+@@ -232,7 +232,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
+ int64_t offset1, offset2;
+
+ if (buf_size < 10)
+- return -1;
++ return AVERROR(EAGAIN);
+
+ if (AV_RB16(buf) == 0) { /* HD subpicture with 4-byte offsets */
+ big_offsets = 1;
+@@ -247,12 +247,12 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
+ size = READ_OFFSET(buf + (big_offsets ? 2 : 0));
+ cmd_pos = READ_OFFSET(buf + cmd_pos);
+
+- if (cmd_pos < 0 || cmd_pos > buf_size - 2 - offset_size) {
+- if (cmd_pos > size) {
+- av_log(ctx, AV_LOG_ERROR, "Discarding invalid packet\n");
+- return 0;
+- }
++ if (buf_size < size)
+ return AVERROR(EAGAIN);
++
++ if (cmd_pos < 0 || cmd_pos > size) {
++ av_log(ctx, AV_LOG_ERROR, "Discarding invalid packet\n");
++ return AVERROR_INVALIDDATA;
+ }
+
+ while (cmd_pos > 0 && cmd_pos < buf_size - 2 - offset_size) {
+--
+2.23.0
+