diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2017-10-04 11:08:45 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-04 16:02:44 +0000 |
commit | 55469aed5acffcce3259d37418ba9e8b8e60d801 (patch) | |
tree | fbee70533185e962adebb082dfa587e80c325873 /fpdfsdk/pwl/cpwl_scroll_bar.h | |
parent | a5fc8975c865dc3cc90de8ff46ca13fb46c13391 (diff) | |
download | pdfium-55469aed5acffcce3259d37418ba9e8b8e60d801.tar.xz |
Fix UAF in SetVisible().
SetVisible() may be called during Destroy() which may be called
during SetVisible().
This fixes the latest in a family of bugs that happen after an
instance is freed by code triggered by JS code while it's executing
a method.
The CL has a lot of protection for many of these points where JS
may be executed and potentially destroy objects. The return types
of many methods that may execute JS have been changed to bool,
indicating whether the instance is still alive after the call.
Bug: chromium:770148
Change-Id: If5a9db4d8d6aac10f4dd6b645922bb96c116684d
Reviewed-on: https://pdfium-review.googlesource.com/15190
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl/cpwl_scroll_bar.h')
-rw-r--r-- | fpdfsdk/pwl/cpwl_scroll_bar.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h index 1e71e3b90f..69217323ff 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.h +++ b/fpdfsdk/pwl/cpwl_scroll_bar.h @@ -124,7 +124,7 @@ class CPWL_ScrollBar : public CPWL_Wnd { ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; void OnDestroy() override; - void RePosChildWnd() override; + bool RePosChildWnd() override; void DrawThisAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) override; bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; @@ -145,7 +145,9 @@ class CPWL_ScrollBar : public CPWL_Wnd { protected: void SetScrollRange(float fMin, float fMax, float fClientWidth); void SetScrollPos(float fPos); - void MovePosButton(bool bRefresh); + + // Returns |true| iff this instance is still allocated. + bool MovePosButton(bool bRefresh); void SetScrollStep(float fBigStep, float fSmallStep); void NotifyScrollWindow(); CFX_FloatRect GetScrollArea() const; |