Skip to content

Commit

Permalink
pack-objects: fix thinko in revalidate code
Browse files Browse the repository at this point in the history
When revalidating an entry from an existing pack entry->size and
entry->type are not necessarily the size of the final object
when the entry is deltified, but for base objects they must
match.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Sep 3, 2006
1 parent df6d610 commit 7042dbf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,13 @@ static int revalidate_one(struct object_entry *entry,
void *data, char *type, unsigned long size)
{
int err;
if (!data)
return -1;
if (size != entry->size)
return -1;
err = check_sha1_signature(entry->sha1, data, size,
type_names[entry->type]);
if ((!data) ||
((entry->type != OBJ_DELTA) &&
( (size != entry->size) ||
strcmp(type_names[entry->type], type))))
err = -1;
else
err = check_sha1_signature(entry->sha1, data, size, type);
free(data);
return err;
}
Expand Down

0 comments on commit 7042dbf

Please sign in to comment.