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
30d91760
Unverified
Commit
30d91760
authored
Dec 23, 2017
by
Edward Thomson
Committed by
GitHub
Dec 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4435 from lhchavez/ubsan-shift-overflow
libFuzzer: Prevent a potential shift overflow
parents
1ddc57b3
53f2c6b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/pack.c
+6
-6
No files found.
src/pack.c
View file @
30d91760
...
@@ -934,19 +934,19 @@ git_off_t get_delta_base(
...
@@ -934,19 +934,19 @@ git_off_t get_delta_base(
if
(
type
==
GIT_OBJ_OFS_DELTA
)
{
if
(
type
==
GIT_OBJ_OFS_DELTA
)
{
unsigned
used
=
0
;
unsigned
used
=
0
;
unsigned
char
c
=
base_info
[
used
++
];
unsigned
char
c
=
base_info
[
used
++
];
base_offset
=
c
&
127
;
size_t
unsigned_
base_offset
=
c
&
127
;
while
(
c
&
128
)
{
while
(
c
&
128
)
{
if
(
left
<=
used
)
if
(
left
<=
used
)
return
GIT_EBUFS
;
return
GIT_EBUFS
;
base_offset
+=
1
;
unsigned_
base_offset
+=
1
;
if
(
!
base_offset
||
MSB
(
base_offset
,
7
))
if
(
!
unsigned_base_offset
||
MSB
(
unsigned_
base_offset
,
7
))
return
0
;
/* overflow */
return
0
;
/* overflow */
c
=
base_info
[
used
++
];
c
=
base_info
[
used
++
];
base_offset
=
(
base_offset
<<
7
)
+
(
c
&
127
);
unsigned_base_offset
=
(
unsigned_
base_offset
<<
7
)
+
(
c
&
127
);
}
}
base_offset
=
delta_obj_offset
-
base_offset
;
if
(
unsigned_base_offset
==
0
||
(
size_t
)
delta_obj_offset
<=
unsigned_base_offset
)
if
(
base_offset
<=
0
||
base_offset
>=
delta_obj_offset
)
return
0
;
/* out of bound */
return
0
;
/* out of bound */
base_offset
=
delta_obj_offset
-
unsigned_base_offset
;
*
curpos
+=
used
;
*
curpos
+=
used
;
}
else
if
(
type
==
GIT_OBJ_REF_DELTA
)
{
}
else
if
(
type
==
GIT_OBJ_REF_DELTA
)
{
/* If we have the cooperative cache, search in it first */
/* If we have the cooperative cache, search in it first */
...
...
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