0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 8.1.0593: illegal memory access in libvterm test

Problem:    Illegal memory access in libvterm test.
Solution:   Fix off-by-one error.
This commit is contained in:
Bram Moolenaar
2018-12-15 14:49:34 +01:00
parent 471f658135
commit 37e3edce20
4 changed files with 8 additions and 3 deletions

View File

@@ -52,6 +52,9 @@ INCDIR=$(PREFIX)/include
MANDIR=$(PREFIX)/share/man MANDIR=$(PREFIX)/share/man
MAN3DIR=$(MANDIR)/man3 MAN3DIR=$(MANDIR)/man3
# Uncomment to check for memory access errors with valgrind.
# VALGRIND=1
all: $(LIBRARY) $(BINFILES) all: $(LIBRARY) $(BINFILES)
$(LIBRARY): $(OBJECTS) $(LIBRARY): $(OBJECTS)

View File

@@ -169,9 +169,9 @@ INTERNAL void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list
#else #else
written = vsprintf(buffer, format, args); written = vsprintf(buffer, format, args);
if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur)) { if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur - 1)) {
/* output was truncated */ /* output was truncated */
written = vt->outbuffer_len - vt->outbuffer_cur; written = vt->outbuffer_len - vt->outbuffer_cur - 1;
} }
if (written > 0) if (written > 0)
{ {

View File

@@ -16,7 +16,7 @@ my ( $hin, $hout, $hpid );
{ {
local $ENV{LD_LIBRARY_PATH} = ".libs"; local $ENV{LD_LIBRARY_PATH} = ".libs";
my @command = "t/.libs/harness"; my @command = "t/.libs/harness";
unshift @command, "valgrind", "--quiet", "--error-exitcode=126" if $VALGRIND; unshift @command, "valgrind", "--tool=memcheck", "--leak-check=yes", "--num-callers=25", "--log-file=valgrind.out", "--error-exitcode=126" if $VALGRIND;
$hpid = open2 $hout, $hin, @command or die "Cannot open2 harness - $!"; $hpid = open2 $hout, $hin, @command or die "Cannot open2 harness - $!";
} }

View File

@@ -799,6 +799,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
593,
/**/ /**/
592, 592,
/**/ /**/