mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 7.4.1846
Problem: Ubsan detects a multiplication overflow. Solution: Don't use orig_mouse_time when it's zero. (Dominique Pelle)
This commit is contained in:
25
src/term.c
25
src/term.c
@@ -5031,12 +5031,25 @@ check_termcode(
|
|||||||
* Compute the time elapsed since the previous mouse click.
|
* Compute the time elapsed since the previous mouse click.
|
||||||
*/
|
*/
|
||||||
gettimeofday(&mouse_time, NULL);
|
gettimeofday(&mouse_time, NULL);
|
||||||
timediff = (mouse_time.tv_usec
|
if (orig_mouse_time.tv_sec == 0)
|
||||||
- orig_mouse_time.tv_usec) / 1000;
|
{
|
||||||
if (timediff < 0)
|
/*
|
||||||
--orig_mouse_time.tv_sec;
|
* Avoid computing the difference between mouse_time
|
||||||
timediff += (mouse_time.tv_sec
|
* and orig_mouse_time for the first click, as the
|
||||||
- orig_mouse_time.tv_sec) * 1000;
|
* 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;
|
orig_mouse_time = mouse_time;
|
||||||
if (mouse_code == orig_mouse_code
|
if (mouse_code == orig_mouse_code
|
||||||
&& timediff < p_mouset
|
&& timediff < p_mouset
|
||||||
|
@@ -753,6 +753,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1846,
|
||||||
/**/
|
/**/
|
||||||
1845,
|
1845,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user