From df3301664cd61fd4b95153d5d497db9abe5cba6d Mon Sep 17 00:00:00 2001 From: Benjamin Buchfink Date: Tue, 19 Nov 2019 13:55:38 +0100 Subject: [PATCH] Fixed accession loading bug. --- src/ChangeLog | 3 +++ src/data/taxonomy.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6527c5ed..e1e7c4f3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +[0.9.29] +- Fixed a bug that could cause taxonomy features to function incorrectly, affecting versions 0.9.27 and 0.9.28. + [0.9.28] - Fixed a bug that could cause alignment score overflows for scores > 65535 in frameshift alignment mode. - Fixed a clang compiler error. diff --git a/src/data/taxonomy.h b/src/data/taxonomy.h index 61a6fc15..135107fd 100644 --- a/src/data/taxonomy.h +++ b/src/data/taxonomy.h @@ -49,6 +49,7 @@ struct Taxonomy if (l > max_accesion_len) throw AccessionLengthError(); std::copy(s, s + l, this->s); + std::fill(this->s + l, this->s + max_accesion_len, '\0'); } Accession(const std::string &s) { @@ -58,8 +59,8 @@ struct Taxonomy //this->s[0] = 0; throw AccessionLengthError(); } - else - std::copy(t.c_str(), t.c_str() + t.length(), this->s); + std::copy(t.c_str(), t.c_str() + t.length(), this->s); + std::fill(this->s + t.length(), this->s + max_accesion_len, '\0'); } bool operator<(const Accession &y) const {