pack-objects: fix thinko in revalidate code

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>
maint
Junio C Hamano 2006-09-03 14:44:46 -07:00
parent df6d61017a
commit 7042dbf7a1
1 changed files with 7 additions and 6 deletions

View File

@ -247,12 +247,13 @@ static int revalidate_one(struct object_entry *entry,
void *data, char *type, unsigned long size) void *data, char *type, unsigned long size)
{ {
int err; int err;
if (!data) if ((!data) ||
return -1; ((entry->type != OBJ_DELTA) &&
if (size != entry->size) ( (size != entry->size) ||
return -1; strcmp(type_names[entry->type], type))))
err = check_sha1_signature(entry->sha1, data, size, err = -1;
type_names[entry->type]); else
err = check_sha1_signature(entry->sha1, data, size, type);
free(data); free(data);
return err; return err;
} }