Commit 7042dbf7 authored by Junio C Hamano's avatar Junio C Hamano

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: default avatarJunio C Hamano <[email protected]>
parent df6d6101
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment