summaryrefslogtreecommitdiff
path: root/plugingui/font.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2017-05-25 23:53:08 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2017-05-25 23:53:08 +0200
commitdc244432932a2e727f0dec191861e4b46c327269 (patch)
treebfb819916bfe9656eb52b549fa7d396509179f2f /plugingui/font.cc
parent570065458c6dac9e64493ca3f8453817bb7c3165 (diff)
Fix out of bounds array access in font.cc.
Diffstat (limited to 'plugingui/font.cc')
-rw-r--r--plugingui/font.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugingui/font.cc b/plugingui/font.cc
index a56d392..9f54b16 100644
--- a/plugingui/font.cc
+++ b/plugingui/font.cc
@@ -37,7 +37,7 @@ Font::Font(const std::string& fontfile)
std::size_t px = 0;
std::size_t c;
- for(c = 0; c < (characters.size() - 1) && px < img_font.width(); ++c)
+ for(c = 0; c < characters.size() && px < img_font.width(); ++c)
{
auto& character = characters[c];
character.offset = px + 1;
@@ -71,7 +71,7 @@ Font::Font(const std::string& fontfile)
characters[c] = character;
}
- ++c;
+ --c;
assert(characters[c].offset >= characters[c - 1].offset);
characters[c - 1].width = characters[c].offset - characters[c - 1].offset;