patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] test/compress: fix buffer overflow bug
@ 2021-09-17 15:12 Rebecca Troy
  2021-09-20 13:16 ` Zhang, Roy Fan
  0 siblings, 1 reply; 3+ messages in thread
From: Rebecca Troy @ 2021-09-17 15:12 UTC (permalink / raw)
  To: dev
  Cc: roy.fan.zhang, Rebecca Troy, fiona.trahe, arturx.trybula, stable,
	Ashish Gupta

Fixes stack buffer overflow bug in compressdev autotest, which
was caused by the use of buf_idx in the debug logs. Originally, buf_idx
was treated as an array instead of the reference of an integar.
This was fixed by replacing the use of buf_idx[priv_data->orig_idx] with
the variable i.

Fixes: 466a2c4bb5f4 ("test/compress: improve debug logs")
Fixes: 6bbc5a923625 ("test/compress: refactor unit tests")

Cc: fiona.trahe@intel.com
Cc: arturx.trybula@intel.com
Cc: stable@dpdk.org

Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
---
 app/test/test_compressdev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/app/test/test_compressdev.c b/app/test/test_compressdev.c
index 0571c17ecb..a1b9f06250 100644
--- a/app/test/test_compressdev.c
+++ b/app/test/test_compressdev.c
@@ -1411,7 +1411,6 @@ test_deflate_comp_finalize(const struct interim_data_params *int_data,
 	/* from int_data: */
 	unsigned int num_xforms = int_data->num_xforms;
 	struct rte_comp_xform **compress_xforms = int_data->compress_xforms;
-	uint16_t *buf_idx = int_data->buf_idx;
 	unsigned int num_bufs = int_data->num_bufs;
 
 	/* from test_priv_data: */
@@ -1442,7 +1441,7 @@ test_deflate_comp_finalize(const struct interim_data_params *int_data,
 
 		RTE_LOG(DEBUG, USER1, "Buffer %u compressed by %s from %u to"
 			" %u bytes (level = %d, huffman = %s)\n",
-			buf_idx[priv_data->orig_idx], engine,
+			i, engine,
 			ops_processed[i]->consumed, ops_processed[i]->produced,
 			compress_xform->level,
 			huffman_type_strings[huffman_type]);
@@ -1734,7 +1733,6 @@ test_deflate_decomp_finalize(const struct interim_data_params *int_data,
 	static unsigned int step;
 
 	/* from int_data: */
-	uint16_t *buf_idx = int_data->buf_idx;
 	unsigned int num_bufs = int_data->num_bufs;
 	const char * const *test_bufs = int_data->test_bufs;
 	struct rte_comp_xform **compress_xforms = int_data->compress_xforms;
@@ -1766,7 +1764,7 @@ test_deflate_decomp_finalize(const struct interim_data_params *int_data,
 			strlcpy(engine, "pmd", sizeof(engine));
 		RTE_LOG(DEBUG, USER1,
 			"Buffer %u decompressed by %s from %u to %u bytes\n",
-			buf_idx[priv_data->orig_idx], engine,
+			i, engine,
 			ops_processed[i]->consumed, ops_processed[i]->produced);
 		ops[i] = NULL;
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] test/compress: fix buffer overflow bug
  2021-09-17 15:12 [dpdk-stable] [PATCH] test/compress: fix buffer overflow bug Rebecca Troy
@ 2021-09-20 13:16 ` Zhang, Roy Fan
  2021-09-24 17:54   ` Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Roy Fan @ 2021-09-20 13:16 UTC (permalink / raw)
  To: Troy, Rebecca, dev; +Cc: Trahe, Fiona, Trybula, ArturX, stable, Ashish Gupta

> -----Original Message-----
> From: Troy, Rebecca <rebecca.troy@intel.com>
> Sent: Friday, September 17, 2021 4:12 PM
> To: dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Troy, Rebecca
> <rebecca.troy@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>; Trybula,
> ArturX <arturx.trybula@intel.com>; stable@dpdk.org; Ashish Gupta
> <ashish.gupta@marvell.com>
> Subject: [PATCH] test/compress: fix buffer overflow bug
> 
> Fixes stack buffer overflow bug in compressdev autotest, which
> was caused by the use of buf_idx in the debug logs. Originally, buf_idx
> was treated as an array instead of the reference of an integar.
> This was fixed by replacing the use of buf_idx[priv_data->orig_idx] with
> the variable i.
> 
> Fixes: 466a2c4bb5f4 ("test/compress: improve debug logs")
> Fixes: 6bbc5a923625 ("test/compress: refactor unit tests")
> 
> Cc: fiona.trahe@intel.com
> Cc: arturx.trybula@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
> ---

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] test/compress: fix buffer overflow bug
  2021-09-20 13:16 ` Zhang, Roy Fan
@ 2021-09-24 17:54   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2021-09-24 17:54 UTC (permalink / raw)
  To: Zhang, Roy Fan, Troy, Rebecca, dev
  Cc: Trahe, Fiona, Trybula, ArturX, stable, Ashish Gupta

> > Fixes stack buffer overflow bug in compressdev autotest, which
> > was caused by the use of buf_idx in the debug logs. Originally, buf_idx
> > was treated as an array instead of the reference of an integar.
> > This was fixed by replacing the use of buf_idx[priv_data->orig_idx] with
> > the variable i.
> >
> > Fixes: 466a2c4bb5f4 ("test/compress: improve debug logs")
> > Fixes: 6bbc5a923625 ("test/compress: refactor unit tests")
> >
> > Cc: fiona.trahe@intel.com
> > Cc: arturx.trybula@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
> > ---
> 
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Applied to dpdk-next-crypto



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-24 17:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 15:12 [dpdk-stable] [PATCH] test/compress: fix buffer overflow bug Rebecca Troy
2021-09-20 13:16 ` Zhang, Roy Fan
2021-09-24 17:54   ` Akhil Goyal

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git