summaryrefslogtreecommitdiff
path: root/servers/audio/audio_stream.cpp
diff options
context:
space:
mode:
authorMarcelo Fernandez <marcelofg55@gmail.com>2019-03-02 15:01:26 -0300
committerMarcelo Fernandez <marcelofg55@gmail.com>2019-03-02 19:41:45 -0300
commitf529649cece9f08002c527fca25c45a5e66d2a4b (patch)
tree8b2753e8f5a458f5c77b22110426f41935917114 /servers/audio/audio_stream.cpp
parent90038a4eef6964b4993aa9b70418930f9ea232e4 (diff)
Fix possible crash on AudioDriver::input_buffer_write
Diffstat (limited to 'servers/audio/audio_stream.cpp')
-rw-r--r--servers/audio/audio_stream.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index a6c262d10f..1a6430c499 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -150,7 +150,7 @@ void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_fr
input_ofs = 0;
} else {
for (int i = 0; i < p_frames; i++) {
- if (input_size > input_ofs) {
+ if (input_size > input_ofs && (int)input_ofs < buf.size()) {
float l = (buf[input_ofs++] >> 16) / 32768.f;
if ((int)input_ofs >= buf.size()) {
input_ofs = 0;