aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/mp/mp_karat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/mp/mp_karat.cpp')
-rw-r--r--src/math/mp/mp_karat.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/math/mp/mp_karat.cpp b/src/math/mp/mp_karat.cpp
index 945b3b61a..b25d60637 100644
--- a/src/math/mp/mp_karat.cpp
+++ b/src/math/mp/mp_karat.cpp
@@ -7,6 +7,7 @@
#include <botan/internal/mp_core.h>
#include <botan/internal/mp_asmi.h>
+#include <botan/internal/assert.h>
#include <botan/mem_ops.h>
namespace Botan {
@@ -249,6 +250,8 @@ void bigint_mul(word z[], size_t z_size, word workspace[],
const word x[], size_t x_size, size_t x_sw,
const word y[], size_t y_size, size_t y_sw)
{
+ BOTAN_ASSERT(z_size > x_sw && z_size > y_sw && z_size - x_sw >= y_sw, "Sufficient output size");
+
if(x_sw == 1)
{
bigint_linmul3(z, y, y_sw, x[0]);
@@ -303,6 +306,8 @@ void bigint_mul(word z[], size_t z_size, word workspace[],
void bigint_sqr(word z[], size_t z_size, word workspace[],
const word x[], size_t x_size, size_t x_sw)
{
+ BOTAN_ASSERT(z_size/2 >= x_sw, "Sufficient output size");
+
if(x_sw == 1)
{
bigint_linmul3(z, x, x_sw, x[0]);