From bedea1ef3c8d8cda5429b4148ca02228d4341dd2 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Wed, 21 Aug 2019 13:01:50 -0500 Subject: [PATCH] Avoid undefined behavior from out-of-range access. NFC. --- src/solvespace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solvespace.h b/src/solvespace.h index 4f7f387..6439741 100644 --- a/src/solvespace.h +++ b/src/solvespace.h @@ -214,7 +214,7 @@ class ReadUTF8 { public: ReadUTF8(const std::string &str) : str(str) {} utf8_iterator begin() const { return utf8_iterator(&str[0]); } - utf8_iterator end() const { return utf8_iterator(&str[str.length()]); } + utf8_iterator end() const { return utf8_iterator(&str[0] + str.length()); } };