Skip to content

potential integer underflow #47

@KihongHeo

Description

@KihongHeo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions