Ensure filter_graph is freed on error and validate duration input to prevent integer overflow.
Signed-off-by: 0xBat <[email protected]> --- doc/examples/filter_audio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/examples/filter_audio.c b/doc/examples/filter_audio.c index ad77bf1f89..bb88f4571b 100644 --- a/doc/examples/filter_audio.c +++ b/doc/examples/filter_audio.c @@ -88,6 +88,7 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src, abuffer = avfilter_get_by_name("abuffer"); if (!abuffer) { fprintf(stderr, "Could not find the abuffer filter.\n"); + avfilter_graph_free(&filter_graph); return AVERROR_FILTER_NOT_FOUND; } @@ -279,6 +280,10 @@ int main(int argc, char *argv[]) } duration = atof(argv[1]); + if (duration > (double)2147483647 / INPUT_SAMPLERATE) { + fprintf(stderr, "Duration too long\n"); + return 1; + } nb_frames = duration * INPUT_SAMPLERATE / FRAME_SIZE; if (nb_frames <= 0) { fprintf(stderr, "Invalid duration: %s\n", argv[1]); -- 2.52.0.windows.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
