From ae2665cec4c07a353cf801b3768f31626bd86dbb Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Wed, 8 Mar 2017 11:24:19 +0000 Subject: [PATCH 1/1] Fix for Text::Controller::RepositionSelectionHandles() * Fixes an invalid memory read reported by valgrind. Change-Id: I8625fdbd3203130b73327964d9b5ae063677938f Signed-off-by: Victor Cebollada --- dali-toolkit/internal/text/text-controller-impl.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 2c1b772..c54ca22 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -1964,15 +1964,15 @@ void Controller::Impl::RepositionSelectionHandles() // Whether to retrieve the next line. if( index == lastGlyphOfLine ) { - // Retrieve the next line. - ++lineRun; - - // Get the last glyph of the new line. - lastGlyphOfLine = lineRun->glyphRun.glyphIndex + lineRun->glyphRun.numberOfGlyphs - 1u; - ++lineIndex; if( lineIndex < firstLineIndex + numberOfLines ) { + // Retrieve the next line. + ++lineRun; + + // Get the last glyph of the new line. + lastGlyphOfLine = lineRun->glyphRun.glyphIndex + lineRun->glyphRun.numberOfGlyphs - 1u; + // Keep the offset and height of the current selection box. const float currentLineOffset = selectionBoxInfo->lineOffset; const float currentLineHeight = selectionBoxInfo->lineHeight; -- 2.7.4