summaryrefslogtreecommitdiffstats
path: root/components/wallpaper
diff options
context:
space:
mode:
authorbshe <bshe@chromium.org>2015-01-12 15:40:32 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-12 23:41:41 +0000
commit64931dd255df3be08f387b406264e3f7a7725055 (patch)
treeac439cb5805ce93b1070f751c7fb707f00877862 /components/wallpaper
parent7d7727bff642d53029dab3e1978a5abad399ca9d (diff)
downloadchromium_src-64931dd255df3be08f387b406264e3f7a7725055.zip
chromium_src-64931dd255df3be08f387b406264e3f7a7725055.tar.gz
chromium_src-64931dd255df3be08f387b406264e3f7a7725055.tar.bz2
Fix uninitialized read error in WallpaperManager
WallpaperInfo struct has layout and type enum and they might be used before initialized. This CL adds explict ctor for the struct to fix the uninitialized issue. BUG=445910 Review URL: https://codereview.chromium.org/851443004 Cr-Commit-Position: refs/heads/master@{#311145}
Diffstat (limited to 'components/wallpaper')
-rw-r--r--components/wallpaper/wallpaper_manager_base.cc18
-rw-r--r--components/wallpaper/wallpaper_manager_base.h7
2 files changed, 25 insertions, 0 deletions
diff --git a/components/wallpaper/wallpaper_manager_base.cc b/components/wallpaper/wallpaper_manager_base.cc
index bad455a..28c7fa70 100644
--- a/components/wallpaper/wallpaper_manager_base.cc
+++ b/components/wallpaper/wallpaper_manager_base.cc
@@ -142,6 +142,24 @@ MovableOnDestroyCallback::~MovableOnDestroyCallback() {
callback_.Run();
}
+WallpaperInfo::WallpaperInfo()
+ : layout(WALLPAPER_LAYOUT_CENTER),
+ type(user_manager::User::WALLPAPER_TYPE_COUNT) {
+}
+
+WallpaperInfo::WallpaperInfo(const std::string& in_location,
+ WallpaperLayout in_layout,
+ user_manager::User::WallpaperType in_type,
+ const base::Time& in_date)
+ : location(in_location),
+ layout(in_layout),
+ type(in_type),
+ date(in_date) {
+}
+
+WallpaperInfo::~WallpaperInfo() {
+}
+
const char kWallpaperSequenceTokenName[] = "wallpaper-sequence";
const char kSmallWallpaperSuffix[] = "_small";
diff --git a/components/wallpaper/wallpaper_manager_base.h b/components/wallpaper/wallpaper_manager_base.h
index fb4415f..ec8976a 100644
--- a/components/wallpaper/wallpaper_manager_base.h
+++ b/components/wallpaper/wallpaper_manager_base.h
@@ -58,6 +58,13 @@ class WALLPAPER_EXPORT MovableOnDestroyCallback {
typedef scoped_ptr<MovableOnDestroyCallback> MovableOnDestroyCallbackHolder;
struct WALLPAPER_EXPORT WallpaperInfo {
+ WallpaperInfo();
+ WallpaperInfo(const std::string& in_location,
+ WallpaperLayout in_layout,
+ user_manager::User::WallpaperType in_type,
+ const base::Time& in_date);
+ ~WallpaperInfo();
+
// Either file name of migrated wallpaper including first directory level
// (corresponding to user id hash) or online wallpaper URL.
std::string location;