Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix overflow on large files #76

Closed
wants to merge 1 commit into from

Conversation

iomartin
Copy link
Contributor

@iomartin iomartin commented Jan 4, 2023

If the input is a large file and we allocate memory via malloc, we can cause an overflow when computing the comp_out_sz and decomp_out_sz (lines 4247 and 4250):

test_arg[i].comp_out_sz = test_arg[i].src_sz * 2;
test_arg[i].decomp_out_sz = test_arg[i].src_sz * 5;

This would cause the associated mallocs to fail with ENOMEM.

Fix this by using size_t.

Also fix many other places where the variables from test_arg are copied into other variables.

Signed-off-by: Martin Oliveira martin.oliveira@eideticom.com

If the input is a large file and we allocate memory via malloc, we can
cause an overflow when computing the comp_out_sz and decomp_out_sz
(lines 4247 and 4250):

	test_arg[i].comp_out_sz = test_arg[i].src_sz * 2;
	test_arg[i].decomp_out_sz = test_arg[i].src_sz * 5;

This would cause the associated mallocs to fail with ENOMEM.

Fix this by using size_t.

Also fix many other places where the variables from test_arg are copied
into other variables.

Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
@cfzhu
Copy link
Contributor

cfzhu commented Jan 30, 2023

@iomartin , Very thanks for your patch, we will merge this patch in internal repo firstly and update to this repo when next release.

@cfzhu
Copy link
Contributor

cfzhu commented Mar 24, 2023

Update 7536364

@cfzhu cfzhu closed this Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants