MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / fuzz_video_get_buffer

Function fuzz_video_get_buffer

tools/target_dec_fuzzer.c:113–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL;
112
113static int fuzz_video_get_buffer(AVCodecContext *ctx, AVFrame *frame)
114{
115 ptrdiff_t linesize1[4];
116 size_t size[4];
117 int linesize_align[AV_NUM_DATA_POINTERS];
118 int i, ret, w = frame->width, h = frame->height;
119
120 avcodec_align_dimensions2(ctx, &w, &h, linesize_align);
121 ret = av_image_fill_linesizes(frame->linesize, ctx->pix_fmt, w);
122 if (ret < 0)
123 return ret;
124
125 for (i = 0; i < 4 && frame->linesize[i]; i++)
126 linesize1[i] = frame->linesize[i] =
127 FFALIGN(frame->linesize[i], linesize_align[i]);
128 for (; i < 4; i++)
129 linesize1[i] = 0;
130
131 ret = av_image_fill_plane_sizes(size, ctx->pix_fmt, h, linesize1);
132 if (ret < 0)
133 return ret;
134
135 frame->extended_data = frame->data;
136 for (i = 0; i < 4 && size[i]; i++) {
137 switch(ctx->codec_id) {
138 case AV_CODEC_ID_FFV1:
139 frame->buf[i] = av_buffer_alloc(size[i]);
140 break;
141 default:
142 frame->buf[i] = av_buffer_allocz(size[i]);
143 }
144
145 if (!frame->buf[i])
146 goto fail;
147 frame->data[i] = frame->buf[i]->data;
148 }
149 for (; i < AV_NUM_DATA_POINTERS; i++) {
150 frame->data[i] = NULL;
151 frame->linesize[i] = 0;
152 }
153
154 return 0;
155fail:
156 av_frame_unref(frame);
157 return AVERROR(ENOMEM);
158}
159
160static int fuzz_get_buffer2(AVCodecContext *ctx, AVFrame *frame, int flags)
161{

Callers 1

fuzz_get_buffer2Function · 0.85

Calls 6

av_image_fill_linesizesFunction · 0.85
av_buffer_allocFunction · 0.85
av_buffer_alloczFunction · 0.85
av_frame_unrefFunction · 0.85

Tested by

no test coverage detected