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; icurrent_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; }