avutil/encryption_info: Don't pass NULL to memcpy
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 18 Sep 2019 00:03:58 +0000 (02:03 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 20 Sep 2019 21:26:34 +0000 (23:26 +0200)
commite6018fda14d7cfe2c890fb336c9264c4ea0b6c5c
tree6a154ba9f0e1728e38c21f4ce8c7cfd56d50a5de
parent87a7fc692d8bff99879dc4a27d89e70272b5a79f
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>
libavutil/encryption_info.c