To: vim_dev@googlegroups.com Subject: Patch 7.4.1846 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1846 Problem: Ubsan detects a multiplication overflow. Solution: Don't use orig_mouse_time when it's zero. (Dominique Pelle) Files: src/term.c *** ../vim-7.4.1845/src/term.c 2016-05-05 18:13:59.416035302 +0200 --- src/term.c 2016-05-25 21:45:19.401809733 +0200 *************** *** 5031,5042 **** * Compute the time elapsed since the previous mouse click. */ gettimeofday(&mouse_time, NULL); ! timediff = (mouse_time.tv_usec ! - orig_mouse_time.tv_usec) / 1000; ! if (timediff < 0) ! --orig_mouse_time.tv_sec; ! timediff += (mouse_time.tv_sec ! - orig_mouse_time.tv_sec) * 1000; orig_mouse_time = mouse_time; if (mouse_code == orig_mouse_code && timediff < p_mouset --- 5031,5055 ---- * Compute the time elapsed since the previous mouse click. */ gettimeofday(&mouse_time, NULL); ! if (orig_mouse_time.tv_sec == 0) ! { ! /* ! * Avoid computing the difference between mouse_time ! * and orig_mouse_time for the first click, as the ! * difference would be huge and would cause multiplication ! * overflow. ! */ ! timediff = p_mouset; ! } ! else ! { ! timediff = (mouse_time.tv_usec ! - orig_mouse_time.tv_usec) / 1000; ! if (timediff < 0) ! --orig_mouse_time.tv_sec; ! timediff += (mouse_time.tv_sec ! - orig_mouse_time.tv_sec) * 1000; ! } orig_mouse_time = mouse_time; if (mouse_code == orig_mouse_code && timediff < p_mouset *** ../vim-7.4.1845/src/version.c 2016-05-25 21:48:07.401807422 +0200 --- src/version.c 2016-05-25 21:59:21.405798150 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1846, /**/ -- hundred-and-one symptoms of being an internet addict: 9. All your daydreaming is preoccupied with getting a faster connection to the net: 28.8...ISDN...cable modem...T1...T3. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///