]> git.eshelyaron.com Git - emacs.git/commit
Fix rare undefined behaviors in replace-match
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 3 Aug 2019 19:45:19 +0000 (12:45 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 3 Aug 2019 20:00:27 +0000 (13:00 -0700)
commit13fe8a27042b1539d43727e6df97c386c61c3053
treee176e0687bfd1c7a427b03c170a1463e0a4b515a
parentb60b6ffb35f4ffbeecb73381e58712ff5cdd7e40
Fix rare undefined behaviors in replace-match

* src/search.c (Freplace_match): Simplify by caching search_regs
components.  Fix sanity check for out-of-range subscripts;
it incorrectly allowed negative subscripts, subscripts
equal to search_regs.num_regs, and it had undefined
behavior for subscripts outside ptrdiff_t range.
Improve wording of newly-introduced replace-match diagnostic.
Rework use of opoint, to avoid setting point to an out-of-range value
in rare cases involving modification hooks.
src/search.c