mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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:
parent
97b1ba696b
commit
8b47058c61
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user