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
238e54bc
Commit
238e54bc
authored
Feb 21, 2010
by
Ramsay Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an 64-bit offset table index bounds check for v2 pack index
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
parent
255a0dab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
src/odb.c
+17
-2
No files found.
src/odb.c
View file @
238e54bc
...
...
@@ -746,8 +746,8 @@ 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
;
in
t
j
;
size_t
sz
,
o64_sz
,
o64_len
;
uint32_
t
j
;
if
((
im_fanout
=
git__malloc
(
sizeof
(
*
im_fanout
)
*
256
))
==
NULL
)
return
GIT_ERROR
;
...
...
@@ -775,6 +775,21 @@ static int pack_openidx_v2(git_pack *p)
p
->
im_crc
=
(
uint32_t
*
)(
p
->
im_oid
+
20
*
p
->
obj_cnt
);
p
->
im_offset32
=
p
->
im_crc
+
p
->
obj_cnt
;
p
->
im_offset64
=
p
->
im_offset32
+
p
->
obj_cnt
;
/* check 64-bit offset table index values are within bounds */
o64_sz
=
p
->
idx_map
.
len
-
sz
;
o64_len
=
o64_sz
/
8
;
for
(
j
=
0
;
j
<
p
->
obj_cnt
;
j
++
)
{
uint32_t
o32
=
decode32
(
p
->
im_offset32
+
j
);
if
(
o32
&
0x80000000
)
{
uint32_t
o64_idx
=
(
o32
&
~
0x80000000
);
if
(
o64_idx
>=
o64_len
)
{
free
(
im_fanout
);
return
GIT_ERROR
;
}
}
}
return
GIT_SUCCESS
;
}
...
...
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