Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1b929b3d
Unverified
Commit
1b929b3d
authored
Mar 16, 2023
by
Edward Thomson
Committed by
GitHub
Mar 16, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6530 from libgit2/cmn/pack-index-64
pack: use 64 bits for the number of objects
parents
8f8e805e
1d57344c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
src/libgit2/pack.c
+4
-5
No files found.
src/libgit2/pack.c
View file @
1b929b3d
...
...
@@ -200,7 +200,7 @@ static void pack_index_free(struct git_pack_file *p)
static
int
pack_index_check_locked
(
const
char
*
path
,
struct
git_pack_file
*
p
)
{
struct
git_pack_idx_header
*
hdr
;
uint32_t
version
,
nr
,
i
,
*
index
;
uint32_t
version
,
nr
=
0
,
i
,
*
index
;
void
*
idx_map
;
size_t
idx_size
;
struct
stat
st
;
...
...
@@ -246,7 +246,6 @@ static int pack_index_check_locked(const char *path, struct git_pack_file *p)
version
=
1
;
}
nr
=
0
;
index
=
idx_map
;
if
(
version
>
1
)
...
...
@@ -269,7 +268,7 @@ static int pack_index_check_locked(const char *path, struct git_pack_file *p)
* - 20/32-byte SHA of the packfile
* - 20/32-byte SHA file checksum
*/
if
(
idx_size
!=
(
4
*
256
+
(
nr
*
(
p
->
oid_size
+
4
))
+
(
p
->
oid_size
*
2
)))
{
if
(
idx_size
!=
(
4
*
256
+
(
(
uint64_t
)
nr
*
(
p
->
oid_size
+
4
))
+
(
p
->
oid_size
*
2
)))
{
git_futils_mmap_free
(
&
p
->
index_map
);
return
packfile_error
(
"index is corrupted"
);
}
...
...
@@ -287,8 +286,8 @@ static int pack_index_check_locked(const char *path, struct git_pack_file *p)
* variable sized table containing 8-byte entries
* for offsets larger than 2^31.
*/
u
nsigned
long
min_size
=
8
+
(
4
*
256
)
+
(
nr
*
(
p
->
oid_size
+
4
+
4
))
+
(
p
->
oid_size
*
2
);
u
nsigned
long
max_size
=
min_size
;
u
int64_t
min_size
=
8
+
(
4
*
256
)
+
((
uint64_t
)
nr
*
(
p
->
oid_size
+
4
+
4
))
+
(
p
->
oid_size
*
2
);
u
int64_t
max_size
=
min_size
;
if
(
nr
)
max_size
+=
(
nr
-
1
)
*
8
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment