summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-03-04 21:45:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-04 21:45:47 (GMT)
commit090de6b289ff2d9fc1c82ef85069bd6cba296d63 (patch)
tree3b609b0a9989a67abcc8449f80e6626d48f73509 /cache.h
parentbc0ffd41b92c8539fc7dbe27f256d8bae6b28d05 (diff)
parent7465feba513a8bd3d47f27630ccc9ab7e82d916c (diff)
downloadgit-090de6b289ff2d9fc1c82ef85069bd6cba296d63.zip
git-090de6b289ff2d9fc1c82ef85069bd6cba296d63.tar.gz
git-090de6b289ff2d9fc1c82ef85069bd6cba296d63.tar.bz2
Merge branch 'jk/pack-idx-corruption-safety'
The code to read the pack data using the offsets stored in the pack idx file has been made more carefully check the validity of the data in the idx. * jk/pack-idx-corruption-safety: sha1_file.c: mark strings for translation use_pack: handle signed off_t overflow nth_packed_object_offset: bounds-check extended offset t5313: test bounds-checks of corrupted/malicious pack/idx files
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index d7ff46e..b829410 100644
--- a/cache.h
+++ b/cache.h
@@ -1370,6 +1370,16 @@ extern void clear_delta_base_cache(void);
extern struct packed_git *add_packed_git(const char *path, size_t path_len, int local);
/*
+ * Make sure that a pointer access into an mmap'd index file is within bounds,
+ * and can provide at least 8 bytes of data.
+ *
+ * Note that this is only necessary for variable-length segments of the file
+ * (like the 64-bit extended offset table), as we compare the size to the
+ * fixed-length parts when we open the file.
+ */
+extern void check_pack_index_ptr(const struct packed_git *p, const void *ptr);
+
+/*
* Return the SHA-1 of the nth object within the specified packfile.
* Open the index if it is not already open. The return value points
* at the SHA-1 within the mmapped index. Return NULL if there is an