avfilter/vf_lut3d: Check av_scanf()

Fixes: CID1604398 Unchecked return value
Fixes: CID1604542 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/7.1
Michael Niedermayer 4 months ago
parent 64aa233a88
commit ace2e25720
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 9
      libavfilter/vf_lut3d.c

@ -703,7 +703,8 @@ try_again:
else if (!strncmp(line + 7, "MAX ", 4)) vals = max; else if (!strncmp(line + 7, "MAX ", 4)) vals = max;
if (!vals) if (!vals)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
av_sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2); if (av_sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2) != 3)
return AVERROR_INVALIDDATA;
av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n", av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n",
min[0], min[1], min[2], max[0], max[1], max[2]); min[0], min[1], min[2], max[0], max[1], max[2]);
goto try_again; goto try_again;
@ -1734,12 +1735,14 @@ try_again:
else if (!strncmp(line + 7, "MAX ", 4)) vals = max; else if (!strncmp(line + 7, "MAX ", 4)) vals = max;
if (!vals) if (!vals)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
av_sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2); if (av_sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2) != 3)
return AVERROR_INVALIDDATA;
av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n", av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n",
min[0], min[1], min[2], max[0], max[1], max[2]); min[0], min[1], min[2], max[0], max[1], max[2]);
goto try_again; goto try_again;
} else if (!strncmp(line, "LUT_1D_INPUT_RANGE ", 19)) { } else if (!strncmp(line, "LUT_1D_INPUT_RANGE ", 19)) {
av_sscanf(line + 19, "%f %f", min, max); if (av_sscanf(line + 19, "%f %f", min, max) != 2)
return AVERROR_INVALIDDATA;
min[1] = min[2] = min[0]; min[1] = min[2] = min[0];
max[1] = max[2] = max[0]; max[1] = max[2] = max[0];
goto try_again; goto try_again;

Loading…
Cancel
Save