diff options
| author | Alan Mackenzie | 2022-11-07 12:20:07 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2022-11-07 12:20:07 +0000 |
| commit | c19ca5eb7f27344ca03fa300a65ec9b33dc7253e (patch) | |
| tree | 0c0506c2c0b31da2d95ae5bc77ed0bb1172d4ea7 | |
| parent | 802671493d7c18569dac47ca91a4b7d6e693aff6 (diff) | |
| download | emacs-c19ca5eb7f27344ca03fa300a65ec9b33dc7253e.tar.gz emacs-c19ca5eb7f27344ca03fa300a65ec9b33dc7253e.zip | |
CC Mode: Fix infinite loop in c-brace-stack-at.
This fixes bug #59038. The infinite loop occurred with a buffer containing
Base-64 encoded text rather than appropriate C Mode text.
* lisp/progmodes/cc-engine.el (c-update-brace-stack): Don't execute
c-beginning-of-current-token unless the previous c-syntactic-re-search-forward
has succeeded at least once.
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index d730fddeb08..8cf882d5699 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -6158,9 +6158,10 @@ comment at the start of cc-engine.el for more info." | |||
| 6158 | (setq s (cdr s)))) | 6158 | (setq s (cdr s)))) |
| 6159 | ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds) | 6159 | ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds) |
| 6160 | (push 0 s)))) | 6160 | (push 0 s)))) |
| 6161 | ;; The failing `c-syntactic-re-search-forward' may have left us in the | 6161 | (when (> prev-match-pos 1) ; Has the search matched at least once? |
| 6162 | ;; middle of a token, which might be a significant token. Fix this! | 6162 | ;; The failing `c-syntactic-re-search-forward' may have left us in the |
| 6163 | (c-beginning-of-current-token) | 6163 | ;; middle of a token, which might be a significant token. Fix this! |
| 6164 | (c-beginning-of-current-token)) | ||
| 6164 | (cons (point) | 6165 | (cons (point) |
| 6165 | (cons bound-<> s))))) | 6166 | (cons bound-<> s))))) |
| 6166 | 6167 | ||