[gnome-flashback] common: fix unintentional integer overflow warnings
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] common: fix unintentional integer overflow warnings
- Date: Sat, 5 Mar 2022 12:01:19 +0000 (UTC)
commit e7d0e92e2f46491a08a2b0c8b1f54a9f6366c3ab
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Mar 5 13:40:45 2022 +0200
common: fix unintentional integer overflow warnings
Coverity CID: #1502894, #1514741, #1514742, #1514743
gnome-flashback/libcommon/gf-bg.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gnome-flashback/libcommon/gf-bg.c b/gnome-flashback/libcommon/gf-bg.c
index d9f5ffe..67cb3a9 100644
--- a/gnome-flashback/libcommon/gf-bg.c
+++ b/gnome-flashback/libcommon/gf-bg.c
@@ -1241,12 +1241,12 @@ pixbuf_average_value (GdkPixbuf *pixbuf,
a = *p++;
a_total += a;
- r_total += r * a;
- g_total += g * a;
- b_total += b * a;
+ r_total += (guint64) r * a;
+ g_total += (guint64) g * a;
+ b_total += (guint64) b * a;
}
}
- dividend = height * width * 0xFF;
+ dividend = (guint64) height * width * 0xFF;
a_total *= 0xFF;
} else {
for (row = 0; row < height; row++) {
@@ -1261,7 +1261,7 @@ pixbuf_average_value (GdkPixbuf *pixbuf,
b_total += b;
}
}
- dividend = height * width;
+ dividend = (guint64) height * width;
a_total = dividend * 0xFF;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]