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

Function alloc_plane

tools/target_sws_fuzzer.c:43–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43static int alloc_plane(uint8_t *data[AV_VIDEO_MAX_PLANES], int stride[AV_VIDEO_MAX_PLANES], int w, int h, int format, int *hshift, int *vshift)
44{
45 size_t size[AV_VIDEO_MAX_PLANES];
46 ptrdiff_t ptrdiff_stride[AV_VIDEO_MAX_PLANES];
47 int ret = av_image_fill_linesizes(stride, format, w);
48 if (ret < 0)
49 return -1;
50
51 av_assert0(AV_VIDEO_MAX_PLANES == 4); // Some of the libavutil API has 4 hardcoded so this has undefined behaviour if its not 4
52
53 av_pix_fmt_get_chroma_sub_sample(format, hshift, vshift);
54
55 for(int p=0; p<AV_VIDEO_MAX_PLANES; p++) {
56 stride[p] =
57 ptrdiff_stride[p] = FFALIGN(stride[p], 32);
58 }
59 ret = av_image_fill_plane_sizes(size, format, h, ptrdiff_stride);
60 if (ret < 0)
61 return ret;
62
63 for(int p=0; p<AV_VIDEO_MAX_PLANES; p++) {
64 if (size[p]) {
65 data[p] = av_mallocz(size[p] + 32);
66 if (!data[p])
67 return -1;
68 } else
69 data[p] = NULL;
70 }
71 return 0;
72}
73
74static void free_plane(uint8_t *data[AV_VIDEO_MAX_PLANES])
75{

Callers 1

LLVMFuzzerTestOneInputFunction · 0.85

Calls 4

av_image_fill_linesizesFunction · 0.85
av_malloczFunction · 0.70

Tested by

no test coverage detected