Charcount subend = -1;
c = string_char (XSTRING (newtext), strpos);
- if (c == '\\')
+ if (c == '\\' && strpos < stlen - 1)
{
c = string_char (XSTRING (newtext), ++strpos);
if (c == '&')
Charcount offset = BUF_PT (buf) - search_regs.start[0];
c = string_char (XSTRING (newtext), strpos);
- if (c == '\\')
+ if (c == '\\' && strpos < stlen - 1)
{
c = string_char (XSTRING (newtext), ++strpos);
if (c == '&')