unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: re-search-forward/backward causes a segmentation fault
Date: Mon, 13 Oct 2003 11:11:43 +0900 (JST)	[thread overview]
Message-ID: <200310130211.LAA22568@etlken.m17n.org> (raw)
In-Reply-To: <E1A8CRN-0001Ey-FS@fencepost.gnu.org> (message from Richard Stallman on Sat, 11 Oct 2003 01:37:21 -0400)

In article <E1A8CRN-0001Ey-FS@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> 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
handa@m17n.org

  reply	other threads:[~2003-10-13  2:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200310082328.IAA16073@etlken.m17n.org>
2003-10-11  5:37 ` re-search-forward/backward causes a segmentation fault Richard Stallman
2003-10-13  2:11   ` Kenichi Handa [this message]
2003-10-13 18:21     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200310130211.LAA22568@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).