diff options
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xselect.c | 19 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index acb8eed4722..ef130f8217e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-09-07 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xselect.c (x_fill_property_data): Handle negative XCDR when data | ||
| 4 | is CONSP (Bug#18303). | ||
| 5 | |||
| 1 | 2014-09-07 Eli Zaretskii <eliz@gnu.org> | 6 | 2014-09-07 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * callproc.c (child_setup) [WINDOWSNT]: Don't call exec_failed if | 8 | * callproc.c (child_setup) [WINDOWSNT]: Don't call exec_failed if |
diff --git a/src/xselect.c b/src/xselect.c index 23310b0f867..ed359849be4 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -2299,7 +2299,24 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format) | |||
| 2299 | Lisp_Object o = XCAR (iter); | 2299 | Lisp_Object o = XCAR (iter); |
| 2300 | 2300 | ||
| 2301 | if (INTEGERP (o) || FLOATP (o) || CONSP (o)) | 2301 | if (INTEGERP (o) || FLOATP (o) || CONSP (o)) |
| 2302 | val = cons_to_signed (o, LONG_MIN, LONG_MAX); | 2302 | { |
| 2303 | if (CONSP (o) && INTEGERP (XCAR (o)) && INTEGERP (XCDR (o))) | ||
| 2304 | { | ||
| 2305 | intmax_t v1 = XINT (XCAR (o)); | ||
| 2306 | intmax_t v2 = XINT (XCDR (o)); | ||
| 2307 | /* cons_to_signed does not handle negative values for v2. | ||
| 2308 | For XDnd, v2 might be y of a window, and can be negative. | ||
| 2309 | The XDnd spec. is not explicit about negative values, | ||
| 2310 | but lets do what it says. | ||
| 2311 | */ | ||
| 2312 | if (v1 < 0 || v2 < 0) | ||
| 2313 | val = (v1 << 16) | v2; | ||
| 2314 | else | ||
| 2315 | val = cons_to_signed (o, LONG_MIN, LONG_MAX); | ||
| 2316 | } | ||
| 2317 | else | ||
| 2318 | val = cons_to_signed (o, LONG_MIN, LONG_MAX); | ||
| 2319 | } | ||
| 2303 | else if (STRINGP (o)) | 2320 | else if (STRINGP (o)) |
| 2304 | { | 2321 | { |
| 2305 | block_input (); | 2322 | block_input (); |