summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-08-10 20:53:32 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-08-10 20:53:32 +0000
commitf073139b526a0fe104228098c41fa24fc0c4c65d (patch)
tree81ad075ab01c60009b3ca1c80770a4ea4a305648
parent4a16cc52e0592048151cc3c09634007204ea48db (diff)
downloadcoreutils-f073139b526a0fe104228098c41fa24fc0c4c65d.tar.xz
(struct control): Remove fastmap member.
(extract_regexp): Allocate fastmap separately, since otherwise it might move due to a realloc.
-rw-r--r--ChangeLog7
-rw-r--r--src/csplit.c3
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a95ee39f2..6fc73bc9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-08-10 Paul Eggert <eggert@cs.ucla.edu>
+
+ * src/csplit.c (struct control): Remove fastmap member.
+ (extract_regexp): Allocate fastmap separately, since otherwise
+ it might move due to a realloc. This fixes a bug that led
+ to a core dump on 64-bit sparc Solaris 10 (Sun Studio 10).
+
2006-08-10 Jim Meyering <jim@meyering.net>
* tests/ls/stat-dtype: If "." is tmpfs, skip this test unless uname -s
diff --git a/src/csplit.c b/src/csplit.c
index 1d0119868..07bcb2095 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -69,7 +69,6 @@ struct control
bool ignore; /* If true, produce no output (for regexp). */
bool regexpr; /* True if regular expression was used. */
struct re_pattern_buffer re_compiled; /* Compiled regular expression. */
- char fastmap[UCHAR_MAX + 1]; /* Fastmap for RE_COMPILED. */
};
/* Initial size of data area in buffers. */
@@ -1119,7 +1118,7 @@ extract_regexp (int argnum, bool ignore, char const *str)
p->regexpr = true;
p->re_compiled.buffer = NULL;
p->re_compiled.allocated = 0;
- p->re_compiled.fastmap = p->fastmap;
+ p->re_compiled.fastmap = xmalloc (UCHAR_MAX + 1);
p->re_compiled.translate = NULL;
re_syntax_options =
RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES;