diff options
author | Clément Bœsch <u@pkh.me> | 2013-09-08 18:02:45 +0200 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2013-09-08 18:48:09 +0200 |
commit | 90fc00a623de44e137fe1601b91356e8cd8bdd54 (patch) | |
tree | 1673c23b8d12b4e706725aa739bd98e11dfc936c /libavformat/matroskaenc.c | |
parent | cfcd55db164e0acc0c30b2cf084e6eebe9741d34 (diff) | |
download | ffmpeg-90fc00a623de44e137fe1601b91356e8cd8bdd54.tar.gz |
avformat/subtitles: add a next line jumper and use it.
This fixes a bunch of possible overread in avformat with the idiom p +=
strcspn(p, "\n") + 1 (strcspn() can focus on the trailing '\0' if no
'\n' is found, so the +1 leads to an overread).
Note on lavf/matroskaenc: no extra subtitles.o Makefile dependency is
added because only the header is required for ff_subtitles_next_line().
Note on lavf/mpsubdec: code gets slightly complex to avoid an infinite
loop in the probing since there is no more forced increment.
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 7b69bc3abf..2c128ccbb7 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -28,6 +28,7 @@ #include "isom.h" #include "matroska.h" #include "riff.h" +#include "subtitles.h" #include "wv.h" #include "libavutil/avstring.h" @@ -1363,7 +1364,7 @@ static int srt_get_duration(uint8_t **buf) s_hsec += 1000*s_sec; e_hsec += 1000*e_sec; duration = e_hsec - s_hsec; } - *buf += strcspn(*buf, "\n") + 1; + *buf += ff_subtitles_next_line(*buf); } return duration; } |