diff options
| author | Po Lu | 2022-09-05 09:51:05 +0800 |
|---|---|---|
| committer | Po Lu | 2022-09-05 09:51:22 +0800 |
| commit | 21c8a9d944b37e431f56738c10a9fa7a75f4c3a9 (patch) | |
| tree | c84a5ed76e82c35c2634d52354e1bacfde43ec58 /src | |
| parent | f07505d1ecf15ca9f6e6461e042092ceee96cc25 (diff) | |
| download | emacs-21c8a9d944b37e431f56738c10a9fa7a75f4c3a9.tar.gz emacs-21c8a9d944b37e431f56738c10a9fa7a75f4c3a9.zip | |
Fix crash while converting empty vector to X data
* src/xselect.c (lisp_data_to_selection_data): Assume an empty
vector represents INTEGER data, instead of blindly trying to
aref it's first element.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xselect.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/xselect.c b/src/xselect.c index 74d762f3055..66782d41723 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -2017,7 +2017,17 @@ lisp_data_to_selection_data (struct x_display_info *dpyinfo, | |||
| 2017 | ptrdiff_t i; | 2017 | ptrdiff_t i; |
| 2018 | ptrdiff_t size = ASIZE (obj); | 2018 | ptrdiff_t size = ASIZE (obj); |
| 2019 | 2019 | ||
| 2020 | if (SYMBOLP (AREF (obj, 0))) | 2020 | if (!size) |
| 2021 | { | ||
| 2022 | /* This vector is empty and of unknown type. Assume that it | ||
| 2023 | is a vector of integers. */ | ||
| 2024 | |||
| 2025 | cs->data = NULL; | ||
| 2026 | cs->format = 32; | ||
| 2027 | cs->size = 0; | ||
| 2028 | type = QINTEGER; | ||
| 2029 | } | ||
| 2030 | else if (SYMBOLP (AREF (obj, 0))) | ||
| 2021 | /* This vector is an ATOM set */ | 2031 | /* This vector is an ATOM set */ |
| 2022 | { | 2032 | { |
| 2023 | void *data; | 2033 | void *data; |