From 1ab7b8ac177e323b0c82b9ccdb42ba47229f4e9e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 21 Sep 2011 13:20:36 -0700 Subject: [PATCH] * lread.c (read_filtered_event): Use duration_to_sec_usec. --- src/ChangeLog | 2 ++ src/lread.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index cc0918e6030..f67d1b72bf2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -459,6 +459,8 @@ (openp): Check for out-of-range argument to 'access'. (read1): Use int, not EMACS_INT, where int is wide enough. Don't assume fixnum fits into int. + (read_filtered_event): Use duration_to_sec_usec + to do proper overflow checking on durations. * macros.c (Fstart_kbd_macro): Use xpalloc to check for overflow in size calculation. (Fexecute_kbd_macro): diff --git a/src/lread.c b/src/lread.c index 7b3e0df5e8a..e427688fdc7 100644 --- a/src/lread.c +++ b/src/lread.c @@ -608,8 +608,11 @@ read_filtered_event (int no_switch_frame, int ascii_required, int sec, usec; double duration = extract_float (seconds); - sec = (int) duration; - usec = (duration - sec) * 1000000; + if (0 < duration) + duration_to_sec_usec (duration, &sec, &usec); + else + sec = usec = 0; + EMACS_GET_TIME (end_time); EMACS_SET_SECS_USECS (wait_time, sec, usec); EMACS_ADD_TIME (end_time, end_time, wait_time); -- 2.39.2