Mercurial > hg > mercurial-crew-with-dirclash
view templates/header.tmpl @ 827:a61728b58dc0
Fix array overflow bug in bdiff
I ran into a bug while importing a large repository into mercurial.
The diff algorithm does not allocate a big enough array of hunks
for some test cases. This results in memory corruption, and possibly,
as in my case, a seg fault.
You should be able to reproduce this problem with any case of more
than a few lines that follows this pattern:
a b
= =
1 1
2
2 3
4
3 5
.
4 .
.
5
.
.
.
I.e., "a" has blank lines on every other line that have been removed in
"b". In this case, the number of matching hunks is equal to the number
of lines in "b". This is more than ((an + bn)/4 + 2). I'm not sure what
motivates this formula, but when I changed it to the smaller of an or
bn (+ 1), it works.
[comment added by mpm]
author | "Wallace, Eric S" <eric.s.wallace@intel.com> |
---|---|
date | Thu, 04 Aug 2005 13:25:59 -0800 |
parents | dbe0ce2ae196 |
children | 2073e5a71008 |
line wrap: on
line source
Content-type: text/html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> <!-- a { text-decoration:none; } .parity0 { background-color: #dddddd; } .parity1 { background-color: #eeeeee; } .lineno { width: 60px; color: #aaaaaa; font-size: smaller; } .plusline { color: green; } .minusline { color: red; } .atline { color: purple; } .annotate { font-size: smaller; text-align: right; padding-right: 1em; } .buttons a { background-color: #666666; padding: 2pt; color: white; font-family: sans; font-weight: bold; } .metatag { background-color: #888888; color: white; text-align: right; } /* Common */ pre { margin: 0; } /* Changelog entries */ .changelogEntry { width: 100%; } .changelogEntry th { font-weight: normal; text-align: right; vertical-align: top; width: 15%;} .changelogEntry th.age, .changelogEntry th.firstline { font-weight: bold; } .changelogEntry th.firstline { text-align: left; width: inherit; } /* Tag entries */ #tagEntries { list-style: none; margin: 0; padding: 0; } #tagEntries .tagEntry { list-style: none; margin: 0; padding: 0; } #tagEntries .tagEntry span.node { font-family: monospace; } /* Changeset entry */ #changesetEntry { } #changesetEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; } #changesetEntry th.files, #changesetEntry th.description { vertical-align: top; } /* File diff view */ #filediffEntry { } #filediffEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; } --> </style>