mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
startup-notification: Ensure provided timestamp is always a 64 bit integer
The libsn API provides its timestamps in the "Time" X11 type, which is usually is a typedef for "unsigned long". The type of the "timestamp" parameter of StartupNotificationSequence is a signed 64 bit integer. When building on an architecture where a "unsigned long" is not 64 bit, we'd then pass a 32 bit unsigned integer via a va_list where a signed 64 bit integer is expected causing va_arg to read past the passed 32 bit unsigned integer. Fix this by ensuring that we always pass the expected type via the va_list. Also change the internal timestamp type from time_t (which size is undefined) to gint64, to avoid any potential overflow issues. https://bugzilla.gnome.org/show_bug.cgi?id=762763
This commit is contained in:
parent
2d65b485fd
commit
0882bce989
@ -93,7 +93,7 @@ G_DECLARE_DERIVABLE_TYPE (MetaStartupNotificationSequence,
|
||||
|
||||
typedef struct {
|
||||
gchar *id;
|
||||
time_t timestamp;
|
||||
gint64 timestamp;
|
||||
} MetaStartupNotificationSequencePrivate;
|
||||
|
||||
struct _MetaStartupNotificationSequenceClass {
|
||||
@ -385,9 +385,12 @@ meta_startup_notification_sequence_x11_class_init (MetaStartupNotificationSequen
|
||||
static MetaStartupNotificationSequence *
|
||||
meta_startup_notification_sequence_x11_new (SnStartupSequence *seq)
|
||||
{
|
||||
gint64 timestamp;
|
||||
|
||||
timestamp = sn_startup_sequence_get_timestamp (seq) * 1000;
|
||||
return g_object_new (META_TYPE_STARTUP_NOTIFICATION_SEQUENCE_X11,
|
||||
"id", sn_startup_sequence_get_id (seq),
|
||||
"timestamp", sn_startup_sequence_get_timestamp (seq) * 1000,
|
||||
"timestamp", timestamp,
|
||||
"seq", seq,
|
||||
NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user