Bug 1484910 - Use the CheckedInt API correctly; r=masayuki
authorAlex Gaynor <agaynor@mozilla.com>
Thu, 07 Mar 2019 05:49:44 +0000
changeset 520946 b32055608807968d77af0b75a85e3c7dc49a692f
parent 520945 7f1c8a3ebd950a8f68003982060031eef3c1b555
child 520947 e68932c65a3f21415d615280dad4e77b3deb1118
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1484910
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1484910 - Use the CheckedInt API correctly; r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D21235
widget/TextEvents.h
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -1032,17 +1032,18 @@ class WidgetQueryContentEvent : public W
       mRelativeToInsertionPoint = false;
       // If mOffset + aInsertionPointOffset becomes negative value,
       // we should assume the absolute offset is 0.
       if (mOffset < 0 && -mOffset > aInsertionPointOffset) {
         mOffset = 0;
         return true;
       }
       // Otherwise, we don't allow too large offset.
-      CheckedInt<uint32_t> absOffset = mOffset + aInsertionPointOffset;
+      CheckedInt<uint32_t> absOffset =
+          CheckedInt<uint32_t>(mOffset) + aInsertionPointOffset;
       if (NS_WARN_IF(!absOffset.isValid())) {
         mOffset = UINT32_MAX;
         return false;
       }
       mOffset = absOffset.value();
       return true;
     }
   } mInput;