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 b362f29c authored by Mikaël Salson's avatar Mikaël Salson
Browse files

fasta: When deleting the sequence explicitly put it at NULL

This allows us to further test if the sequence has been deleted and
avoids double free in case the FASTQ file is malformed.
Test added
parent b8b979ca
......@@ -171,8 +171,10 @@ void OnlineFasta::next() {
current.label.erase();
current.sequence.erase();
current.quality.erase();
if (current.seq)
if (current.seq) {
delete [] current.seq;
current.seq = NULL;
}
if (hasNext()) {
switch(line[0]) {
......
......@@ -163,6 +163,14 @@ void testFastaAddThrows() {
}
TAP_TEST(caught == true, TEST_FASTA_INVALID_FILE, "");
caught = false;
try {
Fasta fa1("../../data/malformed7.fq");
} catch(invalid_argument e) {
TAP_TEST(string(e.what()).find("Unexpected EOF") == 0, TEST_FASTA_INVALID_FILE, "");
caught = true;
}
TAP_TEST(caught == true, TEST_FASTA_INVALID_FILE, "");
}
void testSequenceOutputOperator() {
......
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