diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-11 02:51:27 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-11 02:51:54 +0100 |
commit | 8b47058c61af83c28231b860d46ee754ed7a9310 (patch) | |
tree | 4cfdbb98ba136920e71cd2665c66dfa0f03db1c3 | |
parent | 97b1ba696baa1bb87415bad244533ac2beaf3568 (diff) | |
download | ffmpeg-8b47058c61af83c28231b860d46ee754ed7a9310.tar.gz |
ass_split: fix out of array access in ass_split()
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/ass_split.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index 62c8db91a5..413e9c8d06 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -285,14 +285,17 @@ static int ass_split(ASSSplitContext *ctx, const char *buf) while (buf && *buf) { if (sscanf(buf, "[%15[0-9A-Za-z+ ]]%c", section, &c) == 2) { - buf += strcspn(buf, "\n") + 1; + buf += strcspn(buf, "\n"); + buf += !!*buf; for (i=0; i<FF_ARRAY_ELEMS(ass_sections); i++) if (!strcmp(section, ass_sections[i].section)) { ctx->current_section = i; buf = ass_split_section(ctx, buf); } - } else - buf += strcspn(buf, "\n") + 1; + } else { + buf += strcspn(buf, "\n"); + buf += !!*buf; + } } return buf ? 0 : AVERROR_INVALIDDATA; } |