Segmentation fault occurs on substitution in 32-bit systems.
Brought to you by:
buergmann
Substitution command causes segmentation fault in 32 bit systems.
:set mm:s/A/B/gdiff --git a/re.c b/re.c
index bc5cdd8..160b25a 100644
--- a/re.c
+++ b/re.c
@@ -312,7 +312,7 @@ do_substitution(delim, line, startpos, endpos)
refresh();
if (global) {
- if ((undo_count = alloc_buf(endpos - startpos, &undo_buf))) {
+ if ((undo_count = alloc_buf((off_t)(endpos - startpos), &undo_buf))) {
memcpy(undo_buf, startpos + 1, undo_count);
}
undo_start = startpos + 1;
@@ -350,7 +350,7 @@ AGAIN:
repl_count++;
current_start = pagepos + y * Anzahl + xpos();
if (!global) {
- if ((undo_count = alloc_buf(pat_len, &undo_buf))) {
+ if ((undo_count = alloc_buf((off_t)pat_len, &undo_buf))) {
memcpy(undo_buf, current_start, undo_count);
}
undo_start = current_start;
Fixed in 1.4.2