diff options
| author | Jan Djärv | 2014-09-07 19:31:39 +0200 |
|---|---|---|
| committer | Jan Djärv | 2014-09-07 19:31:39 +0200 |
| commit | eee8ec84426af080d82f37ab0280bd96ae6091bd (patch) | |
| tree | 14fa3172984bd3c441eb68c156ceb1c6c94cd4e8 /src/xselect.c | |
| parent | 970d21e8e6aa7e5bafd3f025f66d694b5ae06ba5 (diff) | |
| download | emacs-eee8ec84426af080d82f37ab0280bd96ae6091bd.tar.gz emacs-eee8ec84426af080d82f37ab0280bd96ae6091bd.zip | |
* xselect.c (x_fill_property_data): Handle negative XCDR when data
is CONSP.
Fixes: debbugs:18303
Diffstat (limited to 'src/xselect.c')
| -rw-r--r-- | src/xselect.c | 19 |
1 files changed, 18 insertions, 1 deletions
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 (); |