mirror of https://github.com/mpv-player/mpv
audio_buffer: fix some more theoretical UB
This may call memmove() with size==0 and a NULL data pointer. In addition to this being UB with memmove(), I think it's UB to do arithmetic on a NULL pointer too. Of course, this doesn't matter in practice at all, and is just stupidity to torture programmers.
This commit is contained in:
parent
fae31f39c7
commit
4e4949b4dc
|
@ -87,6 +87,9 @@ static void copy_planes(struct mp_audio_buffer *ab,
|
|||
uint8_t **dst, int dst_offset,
|
||||
uint8_t **src, int src_offset, int length)
|
||||
{
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
for (int n = 0; n < ab->num_planes; n++) {
|
||||
memmove((char *)dst[n] + dst_offset * ab->sstride,
|
||||
(char *)src[n] + src_offset * ab->sstride,
|
||||
|
|
Loading…
Reference in New Issue