summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: df6d610)
raw | patch | inline | side by side (parent: df6d610)
author | Junio C Hamano <junkio@cox.net> | |
Sun, 3 Sep 2006 21:44:46 +0000 (14:44 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 3 Sep 2006 21:44:46 +0000 (14:44 -0700) |
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>
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>
builtin-pack-objects.c | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 11cc3c89f5789366100f80267d0f9c4d87f3745d..5e42387a450cd2385aa4c1a09539f225e6b5caf3 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
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;
}