emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: re-search-forward/backward causes a segmentation fault


From: Kenichi Handa
Subject: Re: re-search-forward/backward causes a segmentation fault
Date: Mon, 13 Oct 2003 11:11:43 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Richard Stallman <address@hidden> writes:

> The regexp you showedme is too big to be handled with the current
> regexp format.  The bug was that regex.c thought that 2^16 bytes was
> the limit.  Since jump offsets are signed, really only 2^15 bytes can
> be accommodated.

I see.  So, regex_compile should check the size of offset
before storing it in a buffer for compiled code.  But,
doesn't it mean that if regex_compile does that check, we
don't have to have the limit of 2^16 as below?

/* This is not an arbitrary limit: the arguments which represent offsets
   into the pattern are two bytes long.  So if 2^16 bytes turns out to
   be too small, many things would have to change.  */
/* Any other compiler which, like MSC, has allocation limit below 2^16
   bytes will have to use approach similar to what was done below for
   MSC and drop MAX_BUF_SIZE a bit.  Otherwise you may end up
   reallocating to 0 bytes.  Such thing is not going to work too well.
   You have been warned!!  */
#if defined _MSC_VER  && !defined WIN32
/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.  */
# define MAX_BUF_SIZE  65500L
#else
# define MAX_BUF_SIZE (1L << 16)
#endif

---
Ken'ichi HANDA
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]