system/vbindiff: Fix segfault.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Willy Sudiarto Raharjo 2014-11-12 06:03:03 +07:00
parent 8c8738cf7c
commit d3d3ca97cd
2 changed files with 28 additions and 1 deletions

View file

@ -0,0 +1,25 @@
From 879a63ac5f0ffdbe7350ccc7438692a6669d26f2 Mon Sep 17 00:00:00 2001
From: Peter Ross <pross@xvid.org>
Date: Sat, 22 Feb 2014 22:50:54 +1100
Subject: [PATCH] vbindiff: prevent segfault when comparing files of different
length
---
vbindiff.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/vbindiff.cpp b/vbindiff.cpp
index 116a037..a032bc6 100644
--- a/vbindiff.cpp
+++ b/vbindiff.cpp
@@ -487,6 +487,8 @@ void FileDisplay::display()
buf[index++] = displayTable[data->line[i][j]];
}
+ if (index < 0)
+ index = 0;
memset(buf + index, ' ', sizeof(buf) - index - 1);
memset(str, ' ', screenWidth - (str - buf2));
--
1.8.3.2

View file

@ -21,7 +21,7 @@
PRGNAM=vbindiff
VERSION=${VERSION:-3.0_beta4}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -68,6 +68,8 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
patch -p1 < $CWD/vbindiff-prevent-segfault.patch
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \