[FFmpeg-cvslog] avformat/jacosubdec: Check timeres

Michael Niedermayer git at videolan.org
Fri Dec 22 01:52:57 EET 2023


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sat Sep 30 19:59:06 2023 +0200| [1ab57bfbdcea5aa3be3cebe9f1fc1b25433cad61] | committer: Michael Niedermayer

avformat/jacosubdec: Check timeres

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 51f0ab8b127282415822959ccad7db95ad749b5d)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ab57bfbdcea5aa3be3cebe9f1fc1b25433cad61
---

 libavformat/jacosubdec.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index dd207dc93e..d112110327 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -236,14 +236,17 @@ static int jacosub_read_header(AVFormatContext *s)
             }
             av_bprintf(&header, "#S %s", p);
             break;
-        case 'T': // ...but must be placed after TIMERES
-            jacosub->timeres = strtol(p, NULL, 10);
-            if (!jacosub->timeres)
+        case 'T': { // ...but must be placed after TIMERES
+            int64_t timeres = strtol(p, NULL, 10);
+            if (timeres <= 0 || timeres > UINT32_MAX) {
                 jacosub->timeres = 30;
-            else
+            } else {
+                jacosub->timeres = timeres;
                 av_bprintf(&header, "#T %s", p);
+            }
             break;
         }
+        }
     }
 
     /* general/essential directives in the extradata */



More information about the ffmpeg-cvslog mailing list