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

Potential Integer Overflow vulnerability in src/ctjhai/minimum-weight.c #57

Open
KSB21ST opened this issue Aug 18, 2021 · 1 comment
Open
Assignees

Comments

@KSB21ST
Copy link

KSB21ST commented Aug 18, 2021

Hi,
It seems that there exists a potential integer overflow. Please find the following description:

  1. M->cols can be an arbitrary large number

    if ( fscanf(fptr, "%d %d %d\n", &M->rows, &M->cols, &M->q) < 0 ) {

  2. Call to malloc with the large integer can cause a memory allocation with an overflowed size

    M->m[i] = (unsigned int *)malloc(M->cols * sizeof(unsigned int));

@osj1961 osj1961 self-assigned this Apr 7, 2022
@osj1961
Copy link
Collaborator

osj1961 commented Apr 7, 2022

Related to another issue where ctjhai's code returns wrong minimum distance results for codes with very long lengths. We should set and document a maximum length -- can switch to using long ints to allow for a pretty huge size -- and include a check before calling malloc (better yet, before even calling the C code).

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

No branches or pull requests

2 participants