diff options
author | Russell Belfer <rb@github.com> | 2012-09-11 17:26:21 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-09-11 17:26:21 -0700 |
commit | a13fb55afdbf9d74c3d4b6aa76476a005da49486 (patch) | |
tree | 9755770eed5893cce9d69e22f4f5a773d8c99220 /src/odb.c | |
parent | 47bfa0be6d509b60eda92705b57d3f7ba89c1c6b (diff) | |
download | libgit2-a13fb55afdbf9d74c3d4b6aa76476a005da49486.tar.gz |
Add tests and improve param checks
Fixed some minor `git_repository_hashfile` issues:
- Fixed incorrect doc (saying that repo could be NULL)
- Added checking of object type value to acceptable ones
- Added more tests for various parameter permutations
Diffstat (limited to 'src/odb.c')
-rw-r--r-- | src/odb.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -117,6 +117,11 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type) git_hash_ctx *ctx; ssize_t read_len; + if (!git_object_typeisloose(type)) { + giterr_set(GITERR_INVALID, "Invalid object type for hash"); + return -1; + } + hdr_len = format_object_header(hdr, sizeof(hdr), size, type); ctx = git_hash_new_ctx(); |