Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit 18a16385 authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud
Browse files

read_score: Avoid buffer overflow

With well chosen qualities we could have a buffer overflow
(asserts are tested only during development).

This is now prevented
parent 08a9fcc4
......@@ -81,7 +81,10 @@ float ReadQualityScore::getScore(const Sequence &sequence) const {
memset(qualities, 0, MAX_QUALITY * sizeof(size_t));
for (size_t i = 0; i < sequence.quality.size(); i++) {
int current_quality = (sequence.quality[i]) - '!';
assert(current_quality < MAX_QUALITY);
if(current_quality >= MAX_QUALITY)
current_quality = MAX_QUALITY - 1;
else if (current_quality < 0)
current_quality = 0;
qualities[current_quality]++;
}
int max_percentile = (int) round(sequence.quality.size()*1. / 100);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment