| 111 | static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL; |
| 112 | |
| 113 | static 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; |
| 155 | fail: |
| 156 | av_frame_unref(frame); |
| 157 | return AVERROR(ENOMEM); |
| 158 | } |
| 159 | |
| 160 | static int fuzz_get_buffer2(AVCodecContext *ctx, AVFrame *frame, int flags) |
| 161 | { |
no test coverage detected