Skip to content

Motif of length < #residues will generate memory overflow, but not compilation error or crash #1

Description

@blinard-BIOINFO

If input motif matrix has a number of positions < to #nucleotides (4 only in current implementation), there is a memory overflow.
Funnily, this doesn't avoid to do pvalue computations without any crash.
However, when activating sanitizer, it is clearly raised.

// Matrix.h

void Matrix::computesIntegerMatrix (double granularity, bool sortColumns) {

   // [...] 
  matInt = new long long *[length];
  for (int k = 0; k < 4; k++ ) {
    matInt[k] = new long long[length];          //   << == overflow, as k will be > length
    std::cout << "test" <<  std::endl;
    for (int p = 0 ; p < length; p++) {
      matInt[k][p] = ROUND_TO_INT((double)(mat[k][p]*this->granularity)); 
    }
  }
  // [...]
}

This will need fix for any future version that will allow amino acids motifs or any generic alphabet.

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