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
3d523345
Commit
3d523345
authored
Nov 19, 2013
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tree-cache: Don't segfault upon corruption
parent
82e6a42c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
src/tree-cache.c
+6
-3
tests/index/tests.c
+9
-0
tests/resources/bad.index
+0
-0
No files found.
src/tree-cache.c
View file @
3d523345
...
...
@@ -178,9 +178,12 @@ void git_tree_cache_free(git_tree_cache *tree)
if
(
tree
==
NULL
)
return
;
for
(
i
=
0
;
i
<
tree
->
children_count
;
++
i
)
git_tree_cache_free
(
tree
->
children
[
i
]);
if
(
tree
->
children
!=
NULL
)
{
for
(
i
=
0
;
i
<
tree
->
children_count
;
++
i
)
git_tree_cache_free
(
tree
->
children
[
i
]);
git__free
(
tree
->
children
);
}
git__free
(
tree
->
children
);
git__free
(
tree
);
}
tests/index/tests.c
View file @
3d523345
...
...
@@ -6,6 +6,7 @@ static const size_t index_entry_count_2 = 1437;
#define TEST_INDEX_PATH cl_fixture("testrepo.git/index")
#define TEST_INDEX2_PATH cl_fixture("gitgit.index")
#define TEST_INDEXBIG_PATH cl_fixture("big.index")
#define TEST_INDEXBAD_PATH cl_fixture("bad.index")
/* Suite data */
...
...
@@ -535,3 +536,11 @@ void test_index_tests__reload_from_disk(void)
git_index_free
(
write_index
);
git_repository_free
(
repo
);
}
void
test_index_tests__corrupted_extension
(
void
)
{
/* sort the entires in an empty index */
git_index
*
index
;
cl_git_fail_with
(
git_index_open
(
&
index
,
TEST_INDEXBAD_PATH
),
GIT_ERROR
);
}
tests/resources/bad.index
0 → 100644
View file @
3d523345
File added
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