• Paul Eggert's avatar
    Fix rare undefined behaviors in replace-match · 13fe8a27
    Paul Eggert authored
    * 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.
    13fe8a27