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
4848dd32
Commit
4848dd32
authored
Mar 14, 2016
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3647 from pks-t/pks/coverity-fixes-round6
Coverity fixes round 6
parents
fa31ee68
2615d0d6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
17 deletions
+45
-17
script/coverity.sh
+16
-2
src/config_file.c
+5
-0
src/describe.c
+2
-1
src/diff_tform.c
+5
-3
src/index.c
+9
-3
src/object.c
+3
-6
src/pack-objects.c
+3
-1
src/submodule.c
+2
-1
No files found.
script/coverity.sh
View file @
4848dd32
...
...
@@ -49,10 +49,24 @@ COVERITY_UNSUPPORTED=1 \
# Upload results
tar
czf libgit2.tgz cov-int
SHA
=
$(
git rev-parse
--short
HEAD
)
curl
\
HTML
=
"
$(
curl
\
--silent
\
--write-out
"
\n
%{http_code}"
\
--form
token
=
"
$COVERITY_TOKEN
"
\
--form
email
=
bs@github.com
\
--form
file
=
@libgit2.tgz
\
--form
version
=
"
$SHA
"
\
--form
description
=
"Travis build"
\
https://scan.coverity.com/builds?project
=
libgit2
https://scan.coverity.com/builds?project
=
libgit2
)
"
# Body is everything up to the last line
BODY
=
"
$(
echo
"
$HTML
"
| head
-n-1
)
"
# Status code is the last line
STATUS_CODE
=
"
$(
echo
"
$HTML
"
| tail
-n1
)
"
echo
"
${
BODY
}
"
if
[
"
${
STATUS_CODE
}
"
!=
"201"
]
;
then
echo
"Received error code
${
STATUS_CODE
}
from Coverity"
exit
1
fi
src/config_file.c
View file @
4848dd32
...
...
@@ -1032,6 +1032,11 @@ static int parse_section_header_ext(struct reader *reader, const char *line, con
*/
first_quote
=
strchr
(
line
,
'"'
);
if
(
first_quote
==
NULL
)
{
set_parse_error
(
reader
,
0
,
"Missing quotation marks in section header"
);
return
-
1
;
}
last_quote
=
strrchr
(
line
,
'"'
);
quoted_len
=
last_quote
-
first_quote
;
...
...
src/describe.c
View file @
4848dd32
...
...
@@ -582,7 +582,8 @@ static int describe(
best
=
(
struct
possible_tag
*
)
git_vector_get
(
&
all_matches
,
0
);
if
(
gave_up_on
)
{
git_pqueue_insert
(
&
list
,
gave_up_on
);
if
((
error
=
git_pqueue_insert
(
&
list
,
gave_up_on
))
<
0
)
goto
cleanup
;
seen_commits
--
;
}
if
((
error
=
finish_depth_computation
(
...
...
src/diff_tform.c
View file @
4848dd32
...
...
@@ -261,7 +261,7 @@ static int normalize_find_opts(
if
(
!
given
||
(
given
->
flags
&
GIT_DIFF_FIND_ALL
)
==
GIT_DIFF_FIND_BY_CONFIG
)
{
if
(
diff
->
repo
)
{
if
(
cfg
)
{
char
*
rule
=
git_config__get_string_force
(
cfg
,
"diff.renames"
,
"true"
);
int
boolval
;
...
...
@@ -318,8 +318,10 @@ static int normalize_find_opts(
#undef USE_DEFAULT
if
(
!
opts
->
rename_limit
)
{
opts
->
rename_limit
=
git_config__get_int_force
(
cfg
,
"diff.renamelimit"
,
DEFAULT_RENAME_LIMIT
);
if
(
cfg
)
{
opts
->
rename_limit
=
git_config__get_int_force
(
cfg
,
"diff.renamelimit"
,
DEFAULT_RENAME_LIMIT
);
}
if
(
opts
->
rename_limit
<=
0
)
opts
->
rename_limit
=
DEFAULT_RENAME_LIMIT
;
...
...
src/index.c
View file @
4848dd32
...
...
@@ -963,14 +963,20 @@ static int index_entry_reuc_init(git_index_reuc_entry **reuc_out,
*
reuc_out
=
reuc
=
reuc_entry_alloc
(
path
);
GITERR_CHECK_ALLOC
(
reuc
);
if
((
reuc
->
mode
[
0
]
=
ancestor_mode
)
>
0
)
if
((
reuc
->
mode
[
0
]
=
ancestor_mode
)
>
0
)
{
assert
(
ancestor_oid
);
git_oid_cpy
(
&
reuc
->
oid
[
0
],
ancestor_oid
);
}
if
((
reuc
->
mode
[
1
]
=
our_mode
)
>
0
)
if
((
reuc
->
mode
[
1
]
=
our_mode
)
>
0
)
{
assert
(
our_oid
);
git_oid_cpy
(
&
reuc
->
oid
[
1
],
our_oid
);
}
if
((
reuc
->
mode
[
2
]
=
their_mode
)
>
0
)
if
((
reuc
->
mode
[
2
]
=
their_mode
)
>
0
)
{
assert
(
their_oid
);
git_oid_cpy
(
&
reuc
->
oid
[
2
],
their_oid
);
}
return
0
;
}
...
...
src/object.c
View file @
4848dd32
...
...
@@ -12,6 +12,7 @@
#include "commit.h"
#include "tree.h"
#include "blob.h"
#include "oid.h"
#include "tag.h"
bool
git_object__strict_input_validation
=
true
;
...
...
@@ -166,13 +167,9 @@ int git_object_lookup_prefix(
error
=
git_odb_read
(
&
odb_obj
,
odb
,
id
);
}
}
else
{
git_oid
short_oid
;
git_oid
short_oid
=
{{
0
}}
;
/* We copy the first len*4 bits from id and fill the remaining with 0s */
memcpy
(
short_oid
.
id
,
id
->
id
,
(
len
+
1
)
/
2
);
if
(
len
%
2
)
short_oid
.
id
[
len
/
2
]
&=
0xF0
;
memset
(
short_oid
.
id
+
(
len
+
1
)
/
2
,
0
,
(
GIT_OID_HEXSZ
-
len
)
/
2
);
git_oid__cpy_prefix
(
&
short_oid
,
id
,
len
);
/* If len < GIT_OID_HEXSZ (a strict short oid was given), we have
* 2 options :
...
...
src/pack-objects.c
View file @
4848dd32
...
...
@@ -848,8 +848,10 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
git_packbuilder__cache_unlock
(
pb
);
if
(
overflow
)
if
(
overflow
)
{
git__free
(
delta_buf
);
return
-
1
;
}
trg_object
->
delta_data
=
git__realloc
(
delta_buf
,
delta_size
);
GITERR_CHECK_ALLOC
(
trg_object
->
delta_data
);
...
...
src/submodule.c
View file @
4848dd32
...
...
@@ -80,7 +80,8 @@ static kh_inline int str_equal_no_trailing_slash(const char *a, const char *b)
if
(
blen
>
0
&&
b
[
blen
-
1
]
==
'/'
)
blen
--
;
return
(
alen
==
blen
&&
strncmp
(
a
,
b
,
alen
)
==
0
);
return
(
alen
==
0
&&
blen
==
0
)
||
(
alen
==
blen
&&
strncmp
(
a
,
b
,
alen
)
==
0
);
}
__KHASH_IMPL
(
...
...
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