From 109eb1e7e29455418b40ca00bf5dad3e61e5fc78 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Mon, 9 Nov 2020 22:14:39 +0100 Subject: [PATCH 1/2] Fix undefined behavior when fetching glyphs from the display vector. You can trigger this rather obscure bug by enabling selective display if the second glyph in its display vector has an invalid face. For example, evaluate (set-display-table-slot standard-display-table 'selective-display [?A (?B . invalid)]) and then enable selective display. * src/xdisp.c (next_element_from_display_vector): Check whether next glyph code is valid before accessing it. --- src/xdisp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index ac706d08414..71a5f1c34f0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -8221,10 +8221,10 @@ next_element_from_display_vector (struct it *it) next_face_id = it->dpvec_face_id; else { - int lface_id = - GLYPH_CODE_FACE (it->dpvec[it->current.dpvec_index + 1]); + Lisp_Object gc = it->dpvec[it->current.dpvec_index + 1]; + int lface_id = GLYPH_CODE_P (gc) ? GLYPH_CODE_FACE (gc) : 0; - if (lface_id > 0) + if (lface_id > 0) next_face_id = merge_faces (it->w, Qt, lface_id, it->saved_face_id); } From ac1a2b216089b03c244c8e7ceb577198eb0dc2c2 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 10 Nov 2020 14:53:03 +0100 Subject: [PATCH 2/2] Add more doc-view requirements * lisp/doc-view.el: Add more requirements. --- lisp/doc-view.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 7fdd2588221..b895377f8dc 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -22,10 +22,12 @@ ;;; Requirements: -;; doc-view.el requires GNU Emacs 22.1 or newer. You also need Ghostscript, -;; `dvipdf' (comes with Ghostscript) or `dvipdfm' (comes with teTeX or TeXLive) -;; and `pdftotext', which comes with xpdf (http://www.foolabs.com/xpdf/) or -;; poppler (http://poppler.freedesktop.org/). +;; Viewing PS/PDF/DVI files requires Ghostscript, `dvipdf' (comes with +;; Ghostscript) or `dvipdfm' (comes with teTeX or TeXLive) and +;; `pdftotext', which comes with xpdf (http://www.foolabs.com/xpdf/) +;; or poppler (http://poppler.freedesktop.org/). +;; Djvu documents require `ddjvu' (from DjVuLibre). +;; ODF files require `soffice' (from LibreOffice). ;;; Commentary: