| 140 | } |
| 141 | |
| 142 | static AVFrameSideData *add_side_data_from_buf_ext(AVFrameSideData ***sd, |
| 143 | int *nb_sd, |
| 144 | enum AVFrameSideDataType type, |
| 145 | AVBufferRef *buf, uint8_t *data, |
| 146 | size_t size) |
| 147 | { |
| 148 | AVFrameSideData *ret, **tmp; |
| 149 | |
| 150 | // *nb_sd + 1 needs to fit into an int and a size_t. |
| 151 | if ((unsigned)*nb_sd >= FFMIN(INT_MAX, SIZE_MAX)) |
| 152 | return NULL; |
| 153 | |
| 154 | tmp = av_realloc_array(*sd, *nb_sd + 1, sizeof(**sd)); |
| 155 | if (!tmp) |
| 156 | return NULL; |
| 157 | *sd = tmp; |
| 158 | |
| 159 | ret = av_mallocz(sizeof(*ret)); |
| 160 | if (!ret) |
| 161 | return NULL; |
| 162 | |
| 163 | ret->buf = buf; |
| 164 | ret->data = data; |
| 165 | ret->size = size; |
| 166 | ret->type = type; |
| 167 | |
| 168 | (*sd)[(*nb_sd)++] = ret; |
| 169 | |
| 170 | return ret; |
| 171 | } |
| 172 | |
| 173 | AVFrameSideData *ff_frame_side_data_add_from_buf(AVFrameSideData ***sd, |
| 174 | int *nb_sd, |
no test coverage detected