[vlc-commits] auhal: add missing bounds checking (close #10110)

Felix Paul Kühne git at videolan.org
Thu Dec 26 19:04:36 CET 2013


vlc/vlc-2.1 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Dec 26 17:34:51 2013 +0100| [452e4fd1f26ff4c9c024689d3813e6a5637398a7] | committer: Jean-Baptiste Kempf

auhal: add missing bounds checking (close #10110)

(cherry picked from commit 4598d6ca9965428938efddc8469ee39cc73443e6)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=452e4fd1f26ff4c9c024689d3813e6a5637398a7
---

 modules/audio_output/auhal.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 9749035..f2d3643 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -1445,9 +1445,11 @@ static OSStatus RenderCallbackAnalog(vlc_object_t *p_obj,
     } else {
         int32_t bytesToCopy = __MIN(bytesRequested, availableBytes);
 
-        memcpy(targetBuffer, buffer, bytesToCopy);
-        TPCircularBufferConsume(&p_sys->circular_buffer, bytesToCopy);
-        ioData->mBuffers[0].mDataByteSize = bytesToCopy;
+        if (likely(bytesToCopy > 0)) {
+            memcpy(targetBuffer, buffer, bytesToCopy);
+            TPCircularBufferConsume(&p_sys->circular_buffer, bytesToCopy);
+            ioData->mBuffers[0].mDataByteSize = bytesToCopy;
+        }
     }
 
     vlc_cond_signal(&p_sys->cond);



More information about the vlc-commits mailing list