diff options
| author | Eli Zaretskii | 2017-06-27 11:45:22 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2017-06-27 11:45:22 -0400 |
| commit | 4a5653cd2859308ada4bbf5ffc9fb9b283eef31a (patch) | |
| tree | 2a769aaa43569a191f853a25dd9ce5c10a312a63 /src | |
| parent | 1771d9b8082cf967e3f8b6a436d8766560be9e8d (diff) | |
| download | emacs-4a5653cd2859308ada4bbf5ffc9fb9b283eef31a.tar.gz emacs-4a5653cd2859308ada4bbf5ffc9fb9b283eef31a.zip | |
Avoid segfaults when some display vector is an empty string
* src/xdisp.c (next_element_from_display_vector): Don't try
accessing the dpvec[] array if its size is zero. (Bug#27504)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 784848913c0..8bc5d81f448 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -7768,9 +7768,8 @@ next_element_from_display_vector (struct it *it) | |||
| 7768 | 7768 | ||
| 7769 | /* KFS: This code used to check ip->dpvec[0] instead of the current element. | 7769 | /* KFS: This code used to check ip->dpvec[0] instead of the current element. |
| 7770 | That seemed totally bogus - so I changed it... */ | 7770 | That seemed totally bogus - so I changed it... */ |
| 7771 | gc = it->dpvec[it->current.dpvec_index]; | 7771 | if (it->dpend - it->dpvec > 0 /* empty dpvec[] is invalid */ |
| 7772 | 7772 | && (gc = it->dpvec[it->current.dpvec_index], GLYPH_CODE_P (gc))) | |
| 7773 | if (GLYPH_CODE_P (gc)) | ||
| 7774 | { | 7773 | { |
| 7775 | struct face *this_face, *prev_face, *next_face; | 7774 | struct face *this_face, *prev_face, *next_face; |
| 7776 | 7775 | ||