Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
[PATCH] Fix count-delta overcounting
author
Junio C Hamano
<junkio@cox.net>
Sat, 28 May 2005 19:22:38 +0000
(12:22 -0700)
committer
Linus Torvalds
<torvalds@ppc970.osdl.org>
Sun, 29 May 2005 19:01:06 +0000
(12:01 -0700)
The count-delta routine sometimes overcounted the copied source
material which resulted in unsigned int wraparound.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
count-delta.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
844e6e4
)
diff --git
a/count-delta.c
b/count-delta.c
index 3bcc205f5131a168ac71d9b011d11920e25736f8..e10c832a758f49e9117a3456686d54f8b94ce10b 100644
(file)
--- a/
count-delta.c
+++ b/
count-delta.c
@@
-88,5
+88,8
@@
unsigned long count_delta(void *delta_buf, unsigned long delta_size)
/* delete size is what was _not_ copied from source.
* edit size is that and literal additions.
*/
+ if (src_size + added_literal < copied_from_source)
+ /* we ended up overcounting and underflowed */
+ return 0;
return (src_size - copied_from_source) + added_literal;
}