summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-20 21:31:12 +0100
committerGitHub <noreply@github.com>2019-11-20 21:31:12 +0100
commit083d088de3fe7cd5d825cebebc46ce32fc87b4b0 (patch)
tree9b2524105bf989f6ac0ad1c488ac493f558a391f /scene/resources
parent719254ae0d4e1b7c9be36a4399809caf270d7e86 (diff)
parent99d8626f4a313471410db421891e90fe768cd929 (diff)
Merge pull request #33583 from qarmin/fix_overflows_unitialized
Fix some overflows and unitialized variables
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/audio_stream_sample.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 5b61654c5d..286f9e37cd 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -95,8 +95,8 @@ void AudioStreamPlaybackSample::do_resample(const Depth *p_src, AudioFrame *p_ds
// this function will be compiled branchless by any decent compiler
int32_t final, final_r, next, next_r;
- while (amount--) {
-
+ while (amount) {
+ amount--;
int64_t pos = offset >> MIX_FRAC_BITS;
if (is_stereo && !is_ima_adpcm)
pos <<= 1;
@@ -444,6 +444,7 @@ int AudioStreamSample::get_loop_end() const {
void AudioStreamSample::set_mix_rate(int p_hz) {
+ ERR_FAIL_COND(p_hz == 0);
mix_rate = p_hz;
}
int AudioStreamSample::get_mix_rate() const {