[PATCH 2/9] tools/mpris-player: Fix overflow before type widening

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Expression is evaluated using 32-bit arithmetic before conversion to
64-bit.
---
 tools/mpris-player.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/mpris-player.c b/tools/mpris-player.c
index c94330c..397f064 100644
--- a/tools/mpris-player.c
+++ b/tools/mpris-player.c
@@ -1135,7 +1135,7 @@ static gboolean get_position(const GDBusPropertyTable *property,
 
 	dbus_message_iter_get_basic(&var, &position);
 
-	value = position * 1000;
+	value = position * 1000ll;
 
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_INT64, &value);
 
@@ -1195,7 +1195,7 @@ static gboolean parse_int64_metadata(DBusMessageIter *iter, const char *key,
 
 	dbus_message_iter_get_basic(iter, &duration);
 
-	value = duration * 1000;
+	value = duration * 1000ll;
 
 	dict_append_entry(metadata, key, DBUS_TYPE_INT64, &value);
 
@@ -2412,7 +2412,7 @@ static void player_property_changed(GDBusProxy *proxy, const char *name,
 
 	dbus_message_iter_get_basic(iter, &position);
 
-	value = position * 1000;
+	value = position * 1000ll;
 
 	g_dbus_emit_signal(player->conn, MPRIS_PLAYER_PATH,
 					MPRIS_PLAYER_INTERFACE, "Seeked",
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux