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
298f5df6
Commit
298f5df6
authored
Aug 14, 2018
by
Nelson Elhage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further review comments, fix the build
parent
8189642d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
fuzzers/config_file_fuzzer.c
+25
-9
No files found.
fuzzers/config_file_fuzzer.c
View file @
298f5df6
...
...
@@ -5,34 +5,50 @@
#include <unistd.h>
#include <limits.h>
#define UNUSED(x) (void)(x)
int
foreach_cb
(
const
git_config_entry
*
entry
,
void
*
payload
)
{
UNUSED
(
entry
);
UNUSED
(
payload
);
return
0
;
}
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
static
char
path
[]
=
"/tmp/git.XXXXXX"
;
static
int
fd
=
-
1
;
int
LLVMFuzzerInitialize
(
int
*
argc
,
char
***
argv
)
{
static
int
fd
=
-
1
;
static
char
path
[]
=
"/tmp/git.XXXXXX"
;
if
(
fd
<
0
)
{
git_libgit2_init
();
UNUSED
(
argc
);
UNUSED
(
argv
);
if
(
git_libgit2_init
()
<
0
)
abort
();
fd
=
mkstemp
(
path
);
if
(
fd
<
0
)
{
abort
();
}
}
return
0
;
}
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
{
git_config
*
cfg
=
NULL
;
int
err
=
0
;
if
(
ftruncate
(
fd
,
0
)
!=
0
)
{
abort
();
}
if
(
lseek
(
fd
,
0
,
SEEK_SET
)
!=
0
)
{
abort
();
}
if
(
write
(
fd
,
data
,
size
)
!=
size
)
{
if
(
(
size_t
)
write
(
fd
,
data
,
size
)
!=
size
)
{
abort
();
}
git_config
*
cfg
;
int
err
=
git_config_open_ondisk
(
&
cfg
,
path
);
err
=
git_config_open_ondisk
(
&
cfg
,
path
);
if
(
err
==
0
)
{
git_config_foreach
(
cfg
,
foreach_cb
,
NULL
);
git_config_free
(
cfg
);
...
...
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