@@ -63,6 +63,16 @@ extern void unuse_pack(struct pack_window **);
6363extern void clear_delta_base_cache (void );
6464extern struct packed_git * add_packed_git (const char * path , size_t path_len , int local );
6565
66+ /*
67+ * Make sure that a pointer access into an mmap'd index file is within bounds,
68+ * and can provide at least 8 bytes of data.
69+ *
70+ * Note that this is only necessary for variable-length segments of the file
71+ * (like the 64-bit extended offset table), as we compare the size to the
72+ * fixed-length parts when we open the file.
73+ */
74+ extern void check_pack_index_ptr (const struct packed_git * p , const void * ptr );
75+
6676/*
6777 * Return the SHA-1 of the nth object within the specified packfile.
6878 * Open the index if it is not already open. The return value points
@@ -77,6 +87,11 @@ extern const unsigned char *nth_packed_object_sha1(struct packed_git *, uint32_t
7787 */
7888extern const struct object_id * nth_packed_object_oid (struct object_id * , struct packed_git * , uint32_t n );
7989
90+ /*
91+ * Return the offset of the nth object within the specified packfile.
92+ * The index must already be opened.
93+ */
94+ extern off_t nth_packed_object_offset (const struct packed_git * , uint32_t n );
8095
8196extern void * unpack_entry (struct packed_git * , off_t , enum object_type * , unsigned long * );
8297extern unsigned long unpack_object_header_buffer (const unsigned char * buf , unsigned long len , enum object_type * type , unsigned long * sizep );
@@ -94,4 +109,5 @@ extern int packed_object_info(struct packed_git *pack, off_t offset, struct obje
94109
95110extern void mark_bad_packed_object (struct packed_git * p , const unsigned char * sha1 );
96111extern const struct packed_git * has_packed_and_bad (const unsigned char * sha1 );
112+
97113#endif
0 commit comments