[gnome-settings-daemon] Fix overflow in thumbnail cache housekeeping
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] Fix overflow in thumbnail cache housekeeping
- Date: Fri, 15 Feb 2019 09:56:56 +0000 (UTC)
commit d355f552442b74ca74cf57476f74d90d8103592c
Author: Jing Wang <jingwang13 gmail com>
Date: Thu Feb 14 21:30:13 2019 -0500
Fix overflow in thumbnail cache housekeeping
g_settings_get_int gives a signed 32 bit integer, so setting the thumbnail cache size to 5120 MB (for
example) resulted in an overflow to 1 GB.
Tested on my computer by changing the cache size to a value that would previously overflow and observing
the size of ~/.cache/thumbnails.
plugins/housekeeping/gsd-housekeeping-manager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/housekeeping/gsd-housekeeping-manager.c b/plugins/housekeeping/gsd-housekeeping-manager.c
index 2c94e35d..5ace4179 100644
--- a/plugins/housekeeping/gsd-housekeeping-manager.c
+++ b/plugins/housekeeping/gsd-housekeeping-manager.c
@@ -226,8 +226,8 @@ purge_thumbnail_cache (GsdHousekeepingManager *manager)
g_debug ("housekeeping: checking thumbnail cache size and freshness");
- purge_data.max_age = g_settings_get_int (manager->priv->settings, THUMB_AGE_KEY) * 24 * 60 * 60;
- purge_data.max_size = g_settings_get_int (manager->priv->settings, THUMB_SIZE_KEY) * 1024 * 1024;
+ purge_data.max_age = (glong) g_settings_get_int (manager->priv->settings, THUMB_AGE_KEY) * 24 * 60 *
60;
+ purge_data.max_size = (goffset) g_settings_get_int (manager->priv->settings, THUMB_SIZE_KEY) * 1024
* 1024;
/* if both are set to -1, we don't need to read anything */
if ((purge_data.max_age < 0) && (purge_data.max_size < 0))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]