avfilter/vf_lut3d: check size in parse_dat()

Fixes CID1212261
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-05-10 04:25:43 +02:00
parent dc6b99d6b2
commit 2e55f3e907

View File

@ -274,7 +274,12 @@ static int parse_dat(AVFilterContext *ctx, FILE *f)
NEXT_LINE(skip_line(line));
if (!strncmp(line, "3DLUTSIZE ", 10)) {
lut3d->lutsize = size = strtol(line + 10, NULL, 0);
size = strtol(line + 10, NULL, 0);
if (size < 2 || size > MAX_LEVEL) {
av_log(ctx, AV_LOG_ERROR, "Too large or invalid 3D LUT size\n");
return AVERROR(EINVAL);
}
lut3d->lutsize = size;
NEXT_LINE(skip_line(line));
}
for (k = 0; k < size; k++) {