| 2048 | } |
| 2049 | |
| 2050 | void check_pack_index_ptr(const struct packed_git *p, const void *vptr) |
| 2051 | { |
| 2052 | const unsigned char *ptr = vptr; |
| 2053 | const unsigned char *start = p->index_data; |
| 2054 | const unsigned char *end = start + p->index_size; |
| 2055 | if (ptr < start) |
| 2056 | die(_("offset before start of pack index for %s (corrupt index?)"), |
| 2057 | p->pack_name); |
| 2058 | /* No need to check for underflow; .idx files must be at least 8 bytes */ |
| 2059 | if (ptr >= end - 8) |
| 2060 | die(_("offset beyond end of pack index for %s (truncated index?)"), |
| 2061 | p->pack_name); |
| 2062 | } |
| 2063 | |
| 2064 | off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n) |
| 2065 | { |
no test coverage detected