[AT-SPI] Fixed uint underflow risk 59/245359/10
authorMaria Bialota <m.bialota@samsung.com>
Wed, 7 Oct 2020 14:33:40 +0000 (16:33 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Fri, 23 Oct 2020 13:07:01 +0000 (15:07 +0200)
Change-Id: I7967a7ccf9cfe73beb147f41d2c1850f7ee63da5

dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp

index 7b4e8a2..4650a6d 100644 (file)
@@ -1999,7 +1999,7 @@ Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(
             if (boundary == Dali::Accessibility::TextBoundary::LINE)
               counter++;
           }
-          if ((counter - 1) == offset)
+          if ((counter > 0) && ((counter - 1) == offset))
           {
             range.content = txt.substr(start, index - start + 1);
             range.startOffset = start;
index 1d79c5f..312a54e 100644 (file)
@@ -1936,7 +1936,7 @@ Dali::Accessibility::Range TextField::AccessibleImpl::GetTextAtOffset(
             if (boundary == Dali::Accessibility::TextBoundary::LINE)
               counter++;
           }
-          if ((counter - 1) == offset)
+          if ((counter > 0) && ((counter - 1) == offset))
           {
             range.content = txt.substr(start, index - start + 1);
             range.startOffset = start;
index d02fd67..3ecb376 100755 (executable)
@@ -1077,7 +1077,7 @@ Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(
             if (boundary == Dali::Accessibility::TextBoundary::LINE)
               counter++;
           }
-          if ((counter - 1) == offset)
+          if ((counter > 0) && ((counter - 1) == offset))
           {
             range.content = txt.substr(start, index - start + 1);
             range.startOffset = start;