changeset 4131:1ca664c964e0

don't return uninitialized memory from bdiff.blocks() bdiff.blocks() returns a dummy match at the end of both files; the length of that chunk is never set, so it will sometimes contain random heap garbage. There are apparently workarounds for this elsewhere: # bdiff sometimes gives huge matches past eof, this check eats them,
author Erling Ellingsen <erlingalf@gmail.com>
date Tue, 20 Feb 2007 22:20:16 +0100
parents 178007785be8
children 0d94e4a3ddb4
files mercurial/bdiff.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bdiff.c	Mon Feb 19 10:08:59 2007 +0100
+++ b/mercurial/bdiff.c	Tue Feb 20 22:20:16 2007 +0100
@@ -251,8 +251,8 @@
 	if (pos && l.base && t) {
 		/* generate the matching block list */
 		recurse(a, b, pos, 0, an, 0, bn, &l);
-		l.head->a1 = an;
-		l.head->b1 = bn;
+		l.head->a1 = l.head->a2 = an;
+		l.head->b1 = l.head->b2 = bn;
 		l.head++;
 	}