diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-05-17 05:24:34 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-17 05:24:34 +1000 |
commit | d6734eeba793fe9394daf1f356c09d14594a3775 (patch) | |
tree | a4afa5aaba57312af0f34155a231b5452f173968 /source/rendering/StarTextPainter.cpp | |
parent | da281a0c5286014f952b5a8ce2f346f99c114089 (diff) | |
parent | 14109a5caa4a4c9b54e3d2749d2212d519951f00 (diff) |
Merge pull request #239 from FalseIlyu/string_view_ub
UB trying to dereference end of string view
Diffstat (limited to 'source/rendering/StarTextPainter.cpp')
-rw-r--r-- | source/rendering/StarTextPainter.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/source/rendering/StarTextPainter.cpp b/source/rendering/StarTextPainter.cpp index 7fc02bc..76670ff 100644 --- a/source/rendering/StarTextPainter.cpp +++ b/source/rendering/StarTextPainter.cpp @@ -139,8 +139,7 @@ bool TextPainter::processWrapText(StringView text, unsigned* wrapWidth, WrapText bool finished = true; auto slice = [](StringView::const_iterator a, StringView::const_iterator b) -> StringView { - const char* aPtr = &*a.base(); - return StringView(aPtr, &*b.base() - aPtr); + return StringView(&*a.base(), b.base() - a.base()); }; while (iterator != end) { |