diff options
author | Noam Postavsky <npostavs@gmail.com> | 2016-06-04 09:02:20 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2016-06-16 23:18:00 -0400 |
commit | b49cb0ab9c165c1e861b5dfac5eb7ef6cb9e4e3a (patch) | |
tree | 03215f5a43d7156e8aded110970158da5255ce01 /src/syntax.c | |
parent | d765175ef1179f834c25fd856ace63c3dc37162c (diff) | |
download | emacs-b49cb0ab9c165c1e861b5dfac5eb7ef6cb9e4e3a.tar.gz emacs-b49cb0ab9c165c1e861b5dfac5eb7ef6cb9e4e3a.tar.bz2 emacs-b49cb0ab9c165c1e861b5dfac5eb7ef6cb9e4e3a.zip |
Fbackward_prefix_chars: stay within buffer bounds
The commit 1fd3172d "(Fbackward_prefix_chars): Set point properly while
scanning" (1998-03-18), moved the check against of the position against the
buffer beginning out the loop condition so that we might end up checking
the syntax of characters before the beginning of the buffer. This can
cause segfaults or trigger a "Point before start of properties" error in
`update_interval' (called indirectly from `char_quoted').
* src/syntax.c (Fbackward_prefix_chars): Stop the loop when beginning of
buffer is reached (Bug #3552, Bug #17132, Bug #19379).
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/syntax.c b/src/syntax.c index 0af2a21a220..6e133ad9c27 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3098,8 +3098,9 @@ the prefix syntax flag (p). */) opoint = pos; opoint_byte = pos_byte; - if (pos + 1 > beg) - DEC_BOTH (pos, pos_byte); + if (pos <= beg) + break; + DEC_BOTH (pos, pos_byte); } SET_PT_BOTH (opoint, opoint_byte); |