bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37795: 26.1; Fixnum overflow on dpyinfo->last_user_time


From: Paul Eggert
Subject: bug#37795: 26.1; Fixnum overflow on dpyinfo->last_user_time
Date: Fri, 18 Oct 2019 13:33:06 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

Thanks for reporting that. I installed the attached patches, which are along the lines that you suggested. They also fix a similar bug in xterm.c's x_ewmh_activate_frame.

I also see other places where we do:

    selection_data = list4 (selection_name, selection_value,
                            INT_TO_INTEGER (timestamp), frame);

so maybe we should be using `INT_TO_INTEGER` rather than `make_int`?

Yes for Time values, since Time might be (usually is?) unsigned and might exceed INTMAX_MAX. However, list1i etc. accept signed integers so make_int is fine for them.

Changing list1i etc. to use intmax_t and make_int is a small performance hit in some cases, but is probably worth it given the reliability implications of ignoring integer overflow.

AFAICT the exact value of those timestamps doesn't really matter,

Some Emacs code subtracts Time values and assumes wraparound overflow, so if we shoehorn them into fixnums we would need to take that into account. Probably better to leave things be.

Attachment: 0001-Fix-integer-overflow-bug-in-Time-conversion.patch
Description: Text Data

Attachment: 0002-Generalize-list1i-etc.-to-all-signed-integer-types.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]