aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/srtdec.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2013-09-08 18:28:11 +0200
committerAlexander Strasser <eclipse7@gmx.net>2013-09-16 21:39:34 +0200
commit0a55c882cb6bef5617ea7150c61889272aa08e5e (patch)
tree59d92362758d582809a8d58afb8fcf4262553352 /libavcodec/srtdec.c
parentc09acf9882803fd17762689859032c0866568e27 (diff)
downloadffmpeg-0a55c882cb6bef5617ea7150c61889272aa08e5e.tar.gz
avcodec/srtdec: fix potential overread.
(cherry picked from commit 3a54c221d574ec944db1eddf9df895808f32bf9e) Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Diffstat (limited to 'libavcodec/srtdec.c')
-rw-r--r--libavcodec/srtdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index 267561c866..b16645a01e 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -204,7 +204,8 @@ static const char *read_ts(const char *buf, int *ts_start, int *ts_end,
"%*[ ]X1:%u X2:%u Y1:%u Y2:%u",
&hs, &ms, &ss, ts_start, &he, &me, &se, ts_end,
x1, x2, y1, y2);
- buf += strcspn(buf, "\n") + 1;
+ buf += strcspn(buf, "\n");
+ buf += !!*buf;
if (c >= 8) {
*ts_start = 100*(ss + 60*(ms + 60*hs)) + *ts_start/10;
*ts_end = 100*(se + 60*(me + 60*he)) + *ts_end /10;