[dpdk-dev] test/crypto: fix overflow

Message ID 20170628093103.31763-1-pablo.de.lara.guarch@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

De Lara Guarch, Pablo June 28, 2017, 9:31 a.m. UTC
  In one of the SNOW3G unit tests, insufficient memory
was allocated, leading to a buffer overflow.

Fixes: 2b52e1e95aab ("app/test: add SNOW 3G UEA2 with offset")
CC: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 test/test/test_cryptodev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

De Lara Guarch, Pablo June 28, 2017, 5:57 p.m. UTC | #1
> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Wednesday, June 28, 2017 10:31 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] test/crypto: fix overflow
> 
> In one of the SNOW3G unit tests, insufficient memory was allocated,
> leading to a buffer overflow.
> 
> Fixes: 2b52e1e95aab ("app/test: add SNOW 3G UEA2 with offset")
> CC: stable@dpdk.org
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied to dpdk-next-crypto.

Pablo
  

Patch

diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index eed7385..7e74990 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -3581,7 +3581,7 @@  test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
 #endif
 
 	expected_ciphertext_shifted = rte_malloc(NULL,
-			ceil_byte_length(plaintext_len + extra_offset), 0);
+			ceil_byte_length(plaintext_len * 8 + extra_offset), 0);
 
 	TEST_ASSERT_NOT_NULL(expected_ciphertext_shifted,
 			"failed to reserve memory for ciphertext shifted\n");