* Re: re-search-forward/backward causes a segmentation fault
[not found] <200310082328.IAA16073@etlken.m17n.org>
@ 2003-10-11 5:37 ` Richard Stallman
2003-10-13 2:11 ` Kenichi Handa
0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2003-10-11 5:37 UTC (permalink / raw)
Cc: emacs-devel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: re-search-forward/backward causes a segmentation fault
2003-10-11 5:37 ` re-search-forward/backward causes a segmentation fault Richard Stallman
@ 2003-10-13 2:11 ` Kenichi Handa
2003-10-13 18:21 ` Richard Stallman
0 siblings, 1 reply; 3+ messages in thread
From: Kenichi Handa @ 2003-10-13 2:11 UTC (permalink / raw)
Cc: emacs-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: re-search-forward/backward causes a segmentation fault
2003-10-13 2:11 ` Kenichi Handa
@ 2003-10-13 18:21 ` Richard Stallman
0 siblings, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2003-10-13 18:21 UTC (permalink / raw)
Cc: emacs-devel
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?
regex_compile is the place that checks, and I am going to cut the
value of MAX_BUF_SIZE by 50%.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-10-13 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[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
2003-10-13 18:21 ` Richard Stallman
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).