Re: [PATCH] fix diff-delta bad memory access

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Junio C Hamano <junkio@...>, <git@...>, Randal L. Schwartz <merlyn@...>, Alex Riesen <raa.lkml@...>
Date: Wednesday, May 10, 2006 - 1:27 pm

On Wed, 10 May 2006, Linus Torvalds wrote:


Yep.


No.

The initial allocation assumes a perfectly even distribution of entries 
in which case the entry array would be all populated.

When there are repeated bytes then consecutive blocks will have the same 
hash, and in that case keeping only the first one is useful.

Which means that the entry pointer won't get to the end of the allocated 
space for all entries and I naively assumed that using realloc would 
only mark the allocated memory as smaller than it originally was without 
actually copying any of the remaining data, which is what happened in 
most cases but evidently not always.

But if the buffer moves the hash array containing _pointers_ to hash 
entries gets totally screwed.


Yeah...  I might just do a separate allocation for hash entries as well.

Or maybe even drop the hash chaining altogether (now that the code does 
backward matching that might be worth the code simplification).


Nicolas
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] fix diff-delta bad memory access, Nicolas Pitre, (Wed May 10, 12:26 pm)
Re: [PATCH] fix diff-delta bad memory access, Linus Torvalds, (Wed May 10, 1:00 pm)
Re: [PATCH] fix diff-delta bad memory access, Nicolas Pitre, (Wed May 10, 1:27 pm)
Re: [PATCH] fix diff-delta bad memory access, Linus Torvalds, (Wed May 10, 3:01 pm)
Re: [PATCH] fix diff-delta bad memory access, Nicolas Pitre, (Wed May 10, 3:43 pm)
Re: [PATCH] fix diff-delta bad memory access, Nicolas Pitre, (Wed May 10, 3:57 pm)
Re: [PATCH] fix diff-delta bad memory access, Linus Torvalds, (Wed May 10, 1:18 pm)