Subject: bug#874: Args out of range with new auto-composition implementation

From: "Juanma Barranquero" <[email-masked]>
Date: Thu, 4 Sep 2008 17:25:46 +0200

On Wed, Sep 3, 2008 at 18:21, Juanma Barranquero <[email-masked]> wrote:

> emacs -Q -l testbug.el
> C-h H
> M-: (goto-char 276) <RET>   ;; or move the cursor to any auto-composed char
> M-x testbug <RET>
>
>  => "Args out of range: 274, 274"

Curious. The out of range error is caused by this code in
textprop.c:validate_interval_range

      if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end)
	    && XINT (*end) <= BUF_ZV (b)))
	  args_out_of_range (*begin, *end);

At that point,

  BUF_BEGV (b)  = 1
  BUF_ZV (b)    = 1
  XINT (*begin) = 274
  XINT (*end)   = 274

where *begin and *end point to the position in buffer "HELLO", but b
(and hence object, from which b is extracted) points to the just
created buffer "testbug":

(gdb) p object
$1 = 64949764
(gdb) xbuffer
$2 = (struct buffer *) 0x3df0e00
(unsigned char *) 0x3de6880 "testbug"

so it's no wonder it fails.