1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

tools/target_dec_fuzzer: Assert on AVERROR_BUG

This will bring these bugs to our attention.

Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-04-21 20:01:50 +02:00
parent 40544b4854
commit e73c59c6c3

View File

@ -87,6 +87,7 @@ static int subtitle_handler(AVCodecContext *avctx, AVFrame *unused,
{ {
AVSubtitle sub; AVSubtitle sub;
int ret = avcodec_decode_subtitle2(avctx, &sub, got_sub_ptr, avpkt); int ret = avcodec_decode_subtitle2(avctx, &sub, got_sub_ptr, avpkt);
av_assert0(ret != AVERROR_BUG);
if (ret >= 0 && *got_sub_ptr) if (ret >= 0 && *got_sub_ptr)
avsubtitle_free(&sub); avsubtitle_free(&sub);
return ret; return ret;
@ -96,6 +97,7 @@ static int audio_video_handler(AVCodecContext *avctx, AVFrame *frame,
int *got_frame, const AVPacket *dummy) int *got_frame, const AVPacket *dummy)
{ {
int ret = avcodec_receive_frame(avctx, frame); int ret = avcodec_receive_frame(avctx, frame);
av_assert0(ret != AVERROR_BUG);
*got_frame = ret >= 0; *got_frame = ret >= 0;
return ret; return ret;
} }
@ -469,6 +471,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int res = avcodec_open2(ctx, &c->p, &opts); int res = avcodec_open2(ctx, &c->p, &opts);
if (res < 0) { if (res < 0) {
av_assert0(res != AVERROR_BUG);
avcodec_free_context(&ctx); avcodec_free_context(&ctx);
av_free(parser_avctx); av_free(parser_avctx);
av_parser_close(parser); av_parser_close(parser);
@ -542,6 +545,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (ctx->codec_type != AVMEDIA_TYPE_SUBTITLE) { if (ctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {
int ret = avcodec_send_packet(ctx, avpkt); int ret = avcodec_send_packet(ctx, avpkt);
av_assert0(ret != AVERROR_BUG);
decode_more = ret >= 0; decode_more = ret >= 0;
if(!decode_more) { if(!decode_more) {
ec_pixels += (ctx->width + 32LL) * (ctx->height + 32LL); ec_pixels += (ctx->width + 32LL) * (ctx->height + 32LL);
@ -595,8 +599,10 @@ maximums_reached:
av_packet_unref(avpkt); av_packet_unref(avpkt);
if (ctx->codec_type != AVMEDIA_TYPE_SUBTITLE) if (ctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {
avcodec_send_packet(ctx, NULL); int ret = avcodec_send_packet(ctx, NULL);
av_assert0(ret != AVERROR_BUG);
}
do { do {
got_frame = 0; got_frame = 0;