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
255a0dab
Commit
255a0dab
authored
Feb 19, 2010
by
Ramsay Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a minimum size check when opening an v2 pack index file
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
parent
e8cc449f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
src/odb.c
+8
-0
No files found.
src/odb.c
View file @
255a0dab
...
...
@@ -746,6 +746,7 @@ static int pack_openidx_v2(git_pack *p)
unsigned
char
*
data
=
p
->
idx_map
.
data
;
uint32_t
*
src_fanout
=
(
uint32_t
*
)(
data
+
8
);
uint32_t
*
im_fanout
;
size_t
sz
;
int
j
;
if
((
im_fanout
=
git__malloc
(
sizeof
(
*
im_fanout
)
*
256
))
==
NULL
)
...
...
@@ -761,6 +762,13 @@ static int pack_openidx_v2(git_pack *p)
}
p
->
obj_cnt
=
im_fanout
[
255
];
/* minimum size of .idx file (with empty 64-bit offsets table): */
sz
=
4
+
4
+
256
*
4
+
p
->
obj_cnt
*
(
20
+
4
+
4
)
+
2
*
20
;
if
(
p
->
idx_map
.
len
<
sz
)
{
free
(
im_fanout
);
return
GIT_ERROR
;
}
p
->
idx_search
=
idxv2_search
;
p
->
im_fanout
=
im_fanout
;
p
->
im_oid
=
(
unsigned
char
*
)(
src_fanout
+
256
);
...
...
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