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 underflow #47

Open
KihongHeo opened this issue Jul 28, 2021 · 0 comments
Open

potential integer underflow #47

KihongHeo opened this issue Jul 28, 2021 · 0 comments

Comments

@KihongHeo
Copy link

Hi,

I am wondering if there might exist an integer underflow error:

  1. comm_samples can be an any integer:

    if (ts.fread(&comm_samples, sizeof(int), 1) != 1)

  2. If length is zero, then data_length can be a negative integer:

    data_length = (comm_samples-offset)*comm_channels;

  3. So num_samples can be also a negative integer:

    *num_samples = data_length/comm_channels;

  4. Call to fread with the negative integer:

    if ((n=ts.fread(file_data,get_word_size(actual_sample_type),

  5. memcpy with a negative number can be vulnerable:

    memcpy(buff,&buffer[pos],items_read*size);

Thanks for your time.

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

1 participant