[vlc-commits] hotkeys: fix flawed arithmetic (fixes #25141)

Rémi Denis-Courmont git at videolan.org
Sun Nov 29 22:03:36 CET 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 29 23:02:38 2020 +0200| [30d647f78d40d0834f50e4b2702e00cdd275b00a] | committer: Rémi Denis-Courmont

hotkeys: fix flawed arithmetic (fixes #25141)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30d647f78d40d0834f50e4b2702e00cdd275b00a
---

 modules/control/hotkeys.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 7f554ff301..ad8ba0e6e7 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -223,8 +223,8 @@ INTF_ACTION_HANDLER(PlaylistBookmark)
 {
     bool set = action_id >= ACTIONID_SET_BOOKMARK1 &&
                action_id <= ACTIONID_SET_BOOKMARK10;
-    int id = set ? ACTIONID_SET_BOOKMARK1 : ACTIONID_PLAY_BOOKMARK1;
-    id -= action_id - 1;
+    int id = (set ? 1 - ACTIONID_SET_BOOKMARK1 : 1 - ACTIONID_PLAY_BOOKMARK1);
+    id += action_id;
     char *bookmark_name;
     if (asprintf(&bookmark_name, "bookmark%i", id) == -1)
         return;



More information about the vlc-commits mailing list