Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Allen <bitllama@google.com>2017-12-05 03:05:57 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2017-12-08 02:04:19 +0300
commitcae4445fb7f9bae2e2f318969e1f779729f3c0d1 (patch)
treef89927a7c4ae1dbb8d6ee35e19c1f04cc45fc1c0 /tests
parent65f11d326db773b2353d5066fd6b9191e9b3df81 (diff)
Ensure mapping matrix size is always valid.
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_opus_projection.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/test_opus_projection.c b/tests/test_opus_projection.c
index 01dc42d6..3068cd38 100644
--- a/tests/test_opus_projection.c
+++ b/tests/test_opus_projection.c
@@ -96,6 +96,7 @@ void test_simple_matrix(void)
-29491, 3277, 0, -3277};
int i, ret;
+ opus_int32 simple_matrix_size;
opus_val16 *input_val16;
opus_val16 *output_val16;
opus_int16 *output_int16;
@@ -107,9 +108,12 @@ void test_simple_matrix(void)
output_val16 = (opus_val16 *)opus_alloc(align(sizeof(opus_val16) * SIMPLE_MATRIX_OUTPUT_SIZE));
/* Initialize matrix */
- simple_matrix = (MappingMatrix *)opus_alloc(
- mapping_matrix_get_size(simple_matrix_params.rows,
- simple_matrix_params.cols));
+ simple_matrix_size = mapping_matrix_get_size(simple_matrix_params.rows,
+ simple_matrix_params.cols);
+ if (!simple_matrix_size)
+ test_failed();
+
+ simple_matrix = (MappingMatrix *)opus_alloc(simple_matrix_size);
mapping_matrix_init(simple_matrix, simple_matrix_params.rows,
simple_matrix_params.cols, simple_matrix_params.gain, simple_matrix_data,
sizeof(simple_matrix_data));