summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-02-26 14:37:29 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-02-26 14:37:29 +0100
commita145890aaac0087d36b414bd59c247ae4b70b3e5 (patch)
tree573ae6f8b0a87258582ef760ccda40882c36e054 /test
parentdf7638c3058c59b173f04cadef78c1955ac008f6 (diff)
Added a guard against invalid buffer sizes in the prepare-data functions for tests
Diffstat (limited to 'test')
-rw-r--r--test/routines/level2/xtrsv.hpp1
-rw-r--r--test/routines/level3/xtrsm.hpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/test/routines/level2/xtrsv.hpp b/test/routines/level2/xtrsv.hpp
index 72ebdf9e..fed4378a 100644
--- a/test/routines/level2/xtrsv.hpp
+++ b/test/routines/level2/xtrsv.hpp
@@ -33,6 +33,7 @@ namespace clblast {
template <typename T>
void PrepareData(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
if (args.a_ld < args.n) { return; }
+ if (args.a_size <= 0 || args.x_size <= 0) { return; }
// Copies input buffers to the host
std::vector<T> a_mat_cpu(args.a_size, static_cast<T>(0));
diff --git a/test/routines/level3/xtrsm.hpp b/test/routines/level3/xtrsm.hpp
index 246cb930..1ffaef35 100644
--- a/test/routines/level3/xtrsm.hpp
+++ b/test/routines/level3/xtrsm.hpp
@@ -34,6 +34,7 @@ template <typename T>
void PrepareData(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
const auto k = (args.side == Side::kLeft) ? args.m : args.n;
if (args.a_ld < k) { return; }
+ if (args.a_size <= 0 || args.b_size <= 0) { return; }
// Copies input buffers to the host
std::vector<T> a_mat_cpu(args.a_size, static_cast<T>(0));