Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The timeout value in dunst wraps around #646

Closed
hbakken opened this issue Aug 8, 2019 · 2 comments · Fixed by #647
Closed

The timeout value in dunst wraps around #646

hbakken opened this issue Aug 8, 2019 · 2 comments · Fixed by #647
Assignees
Labels

Comments

@hbakken
Copy link

hbakken commented Aug 8, 2019

dunst internally stores timeouts in microseconds, in a signed 32 bit integer, which wraps around at 2147484, which corresponds to ~40 minutes. Having timeouts longer than that is not unreasonable, so the wrapping should be fixed.

notify-send -t 2147483 foo
will stay on the screen for 35 minutes, while
notify-send -t 2147484 foo
will use the default (for me, 10s)

Installation info

  • Version: Dunst - A customizable and lightweight notification-daemon 1.3.2
  • Install type: package
  • Distro and version: Fedora 30
@bebehei bebehei self-assigned this Aug 8, 2019
@tsipinakis tsipinakis added the Bug label Aug 8, 2019
@tsipinakis
Copy link
Member

I prompted @hbakken to created this issue after a short discussion about the issue on IRC.

What completely flew over my head in that discussion was that it was overflowing on the 32 bit boundary not the 64 bit one. After working that out it was dead simple to pinpoint this, and it got me wondering how I missed that in the review 🤦‍♂️.

@bebehei Posting the patch here since you self-assigned this, not sure if you're preparing a PR with anything else.

diff --git a/src/dbus.c b/src/dbus.c
index 741a1c5..b2fc2cb 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -285,8 +285,9 @@ static struct notification *dbus_message_to_notification(const gchar *sender, GV
                 }
         }
 
-        if (timeout >= 0)
-                n->timeout = timeout * 1000;
+        if (timeout >= 0) {
+                n->timeout = ((gint64)timeout) * 1000;
+        }
 
         g_variant_unref(hints);
         g_variant_type_free(required_type);

@bebehei
Copy link
Member

bebehei commented Aug 9, 2019

Thanks for the hint. I would have searched pretty long. I'll write a DBus test for this probably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants