diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-10-23 13:56:36 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-10-23 13:56:36 -0700 |
| commit | f32af12ceec1c19d8a8a7874523d3a7ceef6eebf (patch) | |
| tree | 9078d206b9956c89334901fd04f8a884f01379d6 /chunk-format.h | |
| parent | ceadf0f3cf51550166a387ec8508bb55e7883057 (diff) | |
| parent | 7538f9d89b001be33a1b682b5cf207c4ba8fd8c5 (diff) | |
| download | git-f32af12ceec1c19d8a8a7874523d3a7ceef6eebf.tar.gz git-f32af12ceec1c19d8a8a7874523d3a7ceef6eebf.zip | |
Merge branch 'jk/chunk-bounds'
The codepaths that read "chunk" formatted files have been corrected
to pay attention to the chunk size and notice broken files.
* jk/chunk-bounds: (21 commits)
t5319: make corrupted large-offset test more robust
chunk-format: drop pair_chunk_unsafe()
commit-graph: detect out-of-order BIDX offsets
commit-graph: check bounds when accessing BIDX chunk
commit-graph: check bounds when accessing BDAT chunk
commit-graph: bounds-check generation overflow chunk
commit-graph: check size of generations chunk
commit-graph: bounds-check base graphs chunk
commit-graph: detect out-of-bounds extra-edges pointers
commit-graph: check size of commit data chunk
midx: check size of revindex chunk
midx: bounds-check large offset chunk
midx: check size of object offset chunk
midx: enforce chunk alignment on reading
midx: check size of pack names chunk
commit-graph: check consistency of fanout table
midx: check size of oid lookup chunk
commit-graph: check size of oid fanout chunk
midx: stop ignoring malformed oid fanout chunk
t: add library for munging chunk-format files
...
Diffstat (limited to 'chunk-format.h')
| -rw-r--r-- | chunk-format.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chunk-format.h b/chunk-format.h index c7794e84ad..14b76180ef 100644 --- a/chunk-format.h +++ b/chunk-format.h @@ -36,20 +36,23 @@ int read_table_of_contents(struct chunkfile *cf, const unsigned char *mfile, size_t mfile_size, uint64_t toc_offset, - int toc_length); + int toc_length, + unsigned expected_alignment); #define CHUNK_NOT_FOUND (-2) /* * Find 'chunk_id' in the given chunkfile and assign the * given pointer to the position in the mmap'd file where - * that chunk begins. + * that chunk begins. Likewise the "size" parameter is filled + * with the size of the chunk. * * Returns CHUNK_NOT_FOUND if the chunk does not exist. */ int pair_chunk(struct chunkfile *cf, uint32_t chunk_id, - const unsigned char **p); + const unsigned char **p, + size_t *size); typedef int (*chunk_read_fn)(const unsigned char *chunk_start, size_t chunk_size, void *data); |
