mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avutil/encryption_info: Don't pass NULL to memcpy
The pointer arguments to memcpy (and several other functions of the C standard library) are not allowed to be NULL, not even when the number of bytes to copy is zero. An AVEncryptionInitInfo's data pointer is explicitly allowed to be NULL and yet av_encryption_init_info_add_side_data unconditionally used it as a source pointer to copy from. This commit changes this so that copying is only done if the number of bytes to copy is > 0. Fixes ticket #8141 as well as a part of ticket #8150. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
87a7fc692d
commit
e6018fda14
@ -331,8 +331,10 @@ uint8_t *av_encryption_init_info_add_side_data(const AVEncryptionInitInfo *info,
|
|||||||
memcpy(cur_buffer, cur_info->key_ids[i], cur_info->key_id_size);
|
memcpy(cur_buffer, cur_info->key_ids[i], cur_info->key_id_size);
|
||||||
cur_buffer += cur_info->key_id_size;
|
cur_buffer += cur_info->key_id_size;
|
||||||
}
|
}
|
||||||
memcpy(cur_buffer, cur_info->data, cur_info->data_size);
|
if (cur_info->data_size > 0) {
|
||||||
cur_buffer += cur_info->data_size;
|
memcpy(cur_buffer, cur_info->data, cur_info->data_size);
|
||||||
|
cur_buffer += cur_info->data_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user