Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(840)

Unified Diff: pdf/pdfium/pdfium_engine.h

Issue 568803004: PDF: Fix uninit memory access in PDFiumEngine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pdf/pdfium/pdfium_engine.cc » ('j') | pdf/pdfium/pdfium_engine.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.h
diff --git a/pdf/pdfium/pdfium_engine.h b/pdf/pdfium/pdfium_engine.h
index 6c8368ae749caff67dc57510de83d2a9df3138db..5999e4175eb306d3ca14afee00ceb10e99ba2f1e 100644
--- a/pdf/pdfium/pdfium_engine.h
+++ b/pdf/pdfium/pdfium_engine.h
@@ -131,6 +131,26 @@ class PDFiumEngine : public PDFEngine,
pp::Point previous_origin_;
};
+ // Used to store mouse down state to handle it in other mouse event handlers.
+ class MouseDownState {
+ public:
+ MouseDownState(const PDFiumPage::Area& area,
+ const PDFiumPage::LinkTarget& target);
+ ~MouseDownState();
+
+ void Set(const PDFiumPage::Area& area,
+ const PDFiumPage::LinkTarget& target);
+ void Reset();
+ bool Matches(const PDFiumPage::Area& area,
+ const PDFiumPage::LinkTarget& target) const;
+
+ private:
+ PDFiumPage::Area area_;
+ PDFiumPage::LinkTarget target_;
+
+ DISALLOW_COPY_AND_ASSIGN(MouseDownState);
+ };
+
friend class SelectionChangeInvalidator;
struct FileAvail : public FX_FILEAVAIL {
@@ -509,22 +529,6 @@ class PDFiumEngine : public PDFEngine,
// True if we're in the middle of selection.
bool selecting_;
- // Used to store mouse down state to handle it in other mouse event handlers.
- struct MouseDownState {
Lei Zhang 2014/09/12 22:49:04 non-trivial struct/class -> class
- MouseDownState() {};
Lei Zhang 2014/09/12 22:49:04 didn't initialize |area_| or |target_| -> :(
- MouseDownState(PDFiumPage::Area area, PDFiumPage::LinkTarget target)
- : area_(area), target_(target) {};
- PDFiumPage::Area area_;
- PDFiumPage::LinkTarget target_;
-
- bool operator==(const MouseDownState& rhs) const {
- return (area_ == rhs.area_) && (target_.url == rhs.target_.url);
Lei Zhang 2014/09/12 22:49:04 what about target_.page ??
- }
-
- bool operator!=(const MouseDownState rhs) const {
Lei Zhang 2014/09/12 22:49:04 const ref
- return (area_ != rhs.area_) || (target_.url != rhs.target_.url);
Lei Zhang 2014/09/12 22:49:04 As written, this could have just been: return !(*t
- }
- };
MouseDownState mouse_down_state_;
// Used for searching.
« no previous file with comments | « no previous file | pdf/pdfium/pdfium_engine.cc » ('j') | pdf/pdfium/pdfium_engine.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698