diff options
| author | Eli Zaretskii | 2020-05-25 17:07:22 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-05-25 17:07:22 +0300 |
| commit | df91c94ca8e87a106c1e8e573802d4e299d26404 (patch) | |
| tree | 7c0636ae55ff905cffe57bceea0e9541281d05c6 /src/cmds.c | |
| parent | 478638e4706716b74de5b1aa3e85c8fd943f17ba (diff) | |
| download | emacs-df91c94ca8e87a106c1e8e573802d4e299d26404.tar.gz emacs-df91c94ca8e87a106c1e8e573802d4e299d26404.zip | |
Fix access to single-byte characters in buffer text
* src/xdisp.c (get_visually_first_element)
(Fbidi_find_overridden_directionality):
* src/cmds.c (Fend_of_line): Use FETCH_BYTE instead of FETCH_CHAR,
and byte position instead of character position, to access
individual bytes of buffer text. This avoids producing invalid
characters and accessing wrong buffer positions. (Bug#41520)
Diffstat (limited to 'src/cmds.c')
| -rw-r--r-- | src/cmds.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmds.c b/src/cmds.c index 5d7a45e65f6..9914b7a01f7 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -203,7 +203,7 @@ to t. */) | |||
| 203 | SET_PT (newpos); | 203 | SET_PT (newpos); |
| 204 | 204 | ||
| 205 | if (PT > newpos | 205 | if (PT > newpos |
| 206 | && FETCH_CHAR (PT - 1) == '\n') | 206 | && FETCH_BYTE (PT_BYTE - 1) == '\n') |
| 207 | { | 207 | { |
| 208 | /* If we skipped over a newline that follows | 208 | /* If we skipped over a newline that follows |
| 209 | an invisible intangible run, | 209 | an invisible intangible run, |
| @@ -214,7 +214,7 @@ to t. */) | |||
| 214 | break; | 214 | break; |
| 215 | } | 215 | } |
| 216 | else if (PT > newpos && PT < ZV | 216 | else if (PT > newpos && PT < ZV |
| 217 | && FETCH_CHAR (PT) != '\n') | 217 | && FETCH_BYTE (PT_BYTE) != '\n') |
| 218 | /* If we skipped something intangible | 218 | /* If we skipped something intangible |
| 219 | and now we're not really at eol, | 219 | and now we're not really at eol, |
| 220 | keep going. */ | 220 | keep going. */ |