From ed8fd6c56bae7bec8d02a4827bbdf4ec063e23ac Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Wed, 2 Jan 2019 19:14:28 +0900 Subject: [PATCH] [Tizen] If the text size is too large, crash or deadlock will occur. So, we limit the length. 3 Dali::Toolkit::Text::ShapeText (text=..., lineBreakInfo=..., scripts=..., fonts=..., startCharacterIndex=startCharacterIndex@entry=0, startGlyphIndex=0, numberOfCharacters=numberOfCharacters@entry=51371, glyphs=..., glyphToCharacterMap=..., charactersPerGlyph=..., newParagraphGlyphs=...) at /usr/src/debug/dali-toolkit-1.3.50.1/build/tizen/dali-toolkit/../../../dali-toolkit/internal/text/shaper.cpp:200 ... currentIndex = 40291 numberOfGlyphsReserved = 66782 totalNumberOfGlyphs = 40203 numberOfNewGlyphs = 40203 glyphToCharacterMapBuffer = 0x9f85f8 glyphIndex = 40196 lastCharacter = 51371 lastGlyph = (gdb)bt 0 memmove () at /usr/src/debug//////////////glibc-2.24/string/../sysdeps/arm/memmove.S:124 1 0xaaa57450 in Dali::VectorAlgorithms::Insert (this=0x9c67f8, at=0x896204a0 "", from=0x9f85f8 "\022", to=, elementSize=36) at /usr/include/dali/public-api/common/dali-vector.h:373 2 0xaaa7d25e in Dali::Vector::Insert (to=, from=0x9f85f8, at=0x896204a0, this=0x9c67f8) at /usr/include/dali/public-api/common/dali-vector.h:624 3 Dali::Toolkit::Text::ShapeText (text=..., lineBreakInfo=..., scripts=..., fonts=..., startCharacterIndex=startCharacterIndex@entry=0, startGlyphIndex=0, numberOfCharacters=numberOfCharacters@entry=51371, glyphs=..., glyphToCharacterMap=..., charactersPerGlyph=..., newParagraphGlyphs=...) at /usr/src/debug/dali-toolkit-1.3.50.1/build/tizen/dali-toolkit/../../../dali-toolkit/internal/text/shaper.cpp:200 4 0xaaa85b68 in Dali::Toolkit::Text::Controller::Impl::UpdateModel (this=0x9f9760, operationsRequired=) at /usr/src/debug/dali-toolkit-1.3.50.1/build/tizen/dali-toolkit/../../../dali-toolkit/internal/text/text-controller-impl.cpp:1019 Change-Id: I33ca1fe7c23db7a76cc66d5950e9bd82c25de5ff --- dali-toolkit/internal/text/text-controller.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 76c7690..d83483f 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -573,6 +573,13 @@ void Controller::SetText( const std::string& text ) utf8 = reinterpret_cast( text.c_str() ); } + const Length maxTextLength = 32768u; // 1024 * 32; + if( textSize > maxTextLength ) + { + DALI_LOG_WARNING( "The text size is too large(%d), limit the length to 32,768u\n", textSize ); + textSize = maxTextLength; + } + // Convert text into UTF-32 Vector& utf32Characters = mImpl->mModel->mLogicalModel->mText; utf32Characters.Resize( textSize ); -- 2.7.4