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
2482559d
Unverified
Commit
2482559d
authored
Dec 15, 2017
by
Patrick Steinhardt
Committed by
GitHub
Dec 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4432 from lhchavez/fix-missing-trailer
libFuzzer: Fix missing trailer crash
parents
c342c131
c8aaba24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
src/indexer.c
+4
-0
tests/pack/indexer.c
+17
-0
No files found.
src/indexer.c
View file @
2482559d
...
...
@@ -951,6 +951,10 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
giterr_set
(
GITERR_INDEXER
,
"unexpected data at the end of the pack"
);
return
-
1
;
}
if
(
idx
->
off
+
20
>
idx
->
pack
->
mwf
.
size
)
{
giterr_set
(
GITERR_INDEXER
,
"missing trailer at the end of the pack"
);
return
-
1
;
}
packfile_trailer
=
git_mwindow_open
(
&
idx
->
pack
->
mwf
,
&
w
,
idx
->
pack
->
mwf
.
size
-
GIT_OID_RAWSZ
,
GIT_OID_RAWSZ
,
&
left
);
if
(
packfile_trailer
==
NULL
)
{
...
...
tests/pack/indexer.c
View file @
2482559d
...
...
@@ -87,6 +87,23 @@ void test_pack_indexer__leaky(void)
git_indexer_free
(
idx
);
}
void
test_pack_indexer__missing_trailer
(
void
)
{
git_indexer
*
idx
=
0
;
git_transfer_progress
stats
=
{
0
};
cl_git_pass
(
git_indexer_new
(
&
idx
,
"."
,
0
,
NULL
,
NULL
,
NULL
));
/* Truncate a valid packfile */
cl_git_pass
(
git_indexer_append
(
idx
,
out_of_order_pack
,
out_of_order_pack_len
-
20
,
&
stats
));
cl_git_fail
(
git_indexer_commit
(
idx
,
&
stats
));
cl_assert
(
giterr_last
()
!=
NULL
);
cl_assert_equal_i
(
giterr_last
()
->
klass
,
GITERR_INDEXER
);
git_indexer_free
(
idx
);
}
void
test_pack_indexer__fix_thin
(
void
)
{
git_indexer
*
idx
=
NULL
;
...
...
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