Fix #90: expand_keyword crashed when string ended with tags because of iterator out of bounds.

This commit is contained in:
Twan van Laarhoven
2020-09-27 01:10:49 +02:00
parent 5840f6c493
commit 04b239322e
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -4,6 +4,9 @@ Magic Set Editor changelog, for the details see `git log`
HEAD: new items added as changes are made HEAD: new items added as changes are made
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Bug fixes:
* Fixed: crash in expand_keywords when given empty tags (#90)
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 2.1.1, 2020-06-14 version 2.1.1, 2020-06-14
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
+1
View File
@@ -542,6 +542,7 @@ String expand_keywords(const String& tagged_str, vector<KeywordMatch> const& mat
// No match, so there is at least one character not part of a keyword // No match, so there is at least one character not part of a keyword
// and possibly some tags before it that we missed // and possibly some tags before it that we missed
skip_tags_for_keyword(true, true); skip_tags_for_keyword(true, true);
if (it == end) break;
out += *it; out += *it;
++it; ++it;
++untagged_pos; ++untagged_pos;