[PATCH] Fix count-delta overcounting
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>
This commit is contained in:
parent
844e6e4d58
commit
8b7d510fb1
@ -88,5 +88,8 @@ unsigned long count_delta(void *delta_buf, unsigned long delta_size)
|
|||||||
/* delete size is what was _not_ copied from source.
|
/* delete size is what was _not_ copied from source.
|
||||||
* edit size is that and literal additions.
|
* 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;
|
return (src_size - copied_from_source) + added_literal;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user