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>
This commit is contained in:
Michael Niedermayer 2013-01-11 02:51:27 +01:00
parent 97b1ba696b
commit 8b47058c61

View File

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