You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avutil/frame: Assert that width/height/channels is 0 for the destination of av_frame*_ref()
This should detect caes where these functions are called in unclean destinations
This commit is contained in:
@@ -375,6 +375,9 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src)
|
|||||||
{
|
{
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
|
|
||||||
|
av_assert1(dst->width == 0 && dst->height == 0);
|
||||||
|
av_assert1(dst->channels == 0);
|
||||||
|
|
||||||
dst->format = src->format;
|
dst->format = src->format;
|
||||||
dst->width = src->width;
|
dst->width = src->width;
|
||||||
dst->height = src->height;
|
dst->height = src->height;
|
||||||
@@ -504,6 +507,9 @@ void av_frame_unref(AVFrame *frame)
|
|||||||
|
|
||||||
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
|
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
|
||||||
{
|
{
|
||||||
|
av_assert1(dst->width == 0 && dst->height == 0);
|
||||||
|
av_assert1(dst->channels == 0);
|
||||||
|
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
if (src->extended_data == src->data)
|
if (src->extended_data == src->data)
|
||||||
dst->extended_data = dst->data;
|
dst->extended_data = dst->data;
|
||||||
|
Reference in New Issue
Block a user