]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add some asserts
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 16 Sep 2014 15:44:06 +0000 (20:44 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 16 Sep 2014 15:44:10 +0000 (20:44 +0500)
src/switch_resample.c

index ed584e39af57ba886d0bbf026ea6f788f57961d6..dcb5d1610e073437f7fdbb0b3c13ba0ad21c9546 100644 (file)
@@ -191,6 +191,7 @@ SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples
 
        if (channels == 0) channels = 1;
 
+       switch_assert((samples * channels * 2) < SWITCH_RECOMMENDED_BUFFER_SIZE);
        assert(divisor);
 
        if (divisor == (uint32_t)-1) {
@@ -260,7 +261,8 @@ SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, u
        uint32_t j = 0;
 
        switch_assert(channels < 11);
-
+       switch_assert((samples * channels * 2) < SWITCH_RECOMMENDED_BUFFER_SIZE);
+       
        if (orig_channels > channels) {
                for (i = 0; i < samples; i++) {
                        int32_t z = 0;