diff options
author | wm4 <wm4@nowhere> | 2019-06-09 19:04:46 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:05 +0200 |
commit | 4e4949b4dc229a3033407100916a474b6d3fd291 (patch) | |
tree | cdc927ccbf914df0c579c31f400c9b4aaa9b834f /audio | |
parent | fae31f39c7c2a8d71b101680e4fa99400ea06a16 (diff) | |
download | mpv-4e4949b4dc229a3033407100916a474b6d3fd291.tar.bz2 mpv-4e4949b4dc229a3033407100916a474b6d3fd291.tar.xz |
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.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio_buffer.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/audio/audio_buffer.c b/audio/audio_buffer.c index b54f1f41b8..a5591e1fe8 100644 --- a/audio/audio_buffer.c +++ b/audio/audio_buffer.c @@ -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, |