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
325375e3
Unverified
Commit
325375e3
authored
Jul 09, 2020
by
Edward Thomson
Committed by
GitHub
Jul 09, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5568 from lhchavez/ubsan
Make the tests run cleanly under UndefinedBehaviorSanitizer
parents
2ffa426e
d0656ac8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
src/apply.c
+3
-0
src/buffer.c
+3
-2
src/index.c
+8
-6
No files found.
src/apply.c
View file @
325375e3
...
...
@@ -66,6 +66,9 @@ static int patch_image_init_fromstr(
if
(
git_pool_init
(
&
out
->
pool
,
sizeof
(
git_diff_line
))
<
0
)
return
-
1
;
if
(
!
in_len
)
return
0
;
for
(
start
=
in
;
start
<
in
+
in_len
;
start
=
end
)
{
end
=
memchr
(
start
,
'\n'
,
in_len
-
(
start
-
in
));
...
...
src/buffer.c
View file @
325375e3
...
...
@@ -365,7 +365,7 @@ int git_buf_encode_base85(git_buf *buf, const char *data, size_t len)
for
(
i
=
24
;
i
>=
0
;
i
-=
8
)
{
uint8_t
ch
=
*
data
++
;
acc
|=
ch
<<
i
;
acc
|=
(
uint32_t
)
ch
<<
i
;
if
(
--
len
==
0
)
break
;
...
...
@@ -759,6 +759,7 @@ int git_buf_join(
ssize_t
offset_a
=
-
1
;
/* not safe to have str_b point internally to the buffer */
if
(
buf
->
size
)
assert
(
str_b
<
buf
->
ptr
||
str_b
>=
buf
->
ptr
+
buf
->
size
);
/* figure out if we need to insert a separator */
...
...
@@ -769,7 +770,7 @@ int git_buf_join(
}
/* str_a could be part of the buffer */
if
(
str_a
>=
buf
->
ptr
&&
str_a
<
buf
->
ptr
+
buf
->
size
)
if
(
buf
->
size
&&
str_a
>=
buf
->
ptr
&&
str_a
<
buf
->
ptr
+
buf
->
size
)
offset_a
=
str_a
-
buf
->
ptr
;
GIT_ERROR_CHECK_ALLOC_ADD
(
&
alloc_len
,
strlen_a
,
strlen_b
);
...
...
src/index.c
View file @
325375e3
...
...
@@ -2781,17 +2781,19 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const cha
ondisk
.
flags
=
htons
(
entry
->
flags
);
if
(
entry
->
flags
&
GIT_INDEX_ENTRY_EXTENDED
)
{
const
size_t
path_offset
=
offsetof
(
struct
entry_long
,
path
);
struct
entry_long
ondisk_ext
;
memcpy
(
&
ondisk_ext
,
&
ondisk
,
sizeof
(
struct
entry_short
));
ondisk_ext
.
flags_extended
=
htons
(
entry
->
flags_extended
&
GIT_INDEX_ENTRY_EXTENDED_FLAGS
);
memcpy
(
mem
,
&
ondisk_ext
,
offsetof
(
struct
entry_long
,
path
)
);
path
=
(
(
struct
entry_long
*
)
mem
)
->
path
;
disk_size
-=
offsetof
(
struct
entry_long
,
path
)
;
memcpy
(
mem
,
&
ondisk_ext
,
path_offset
);
path
=
(
char
*
)
mem
+
path_offset
;
disk_size
-=
path_offset
;
}
else
{
memcpy
(
mem
,
&
ondisk
,
offsetof
(
struct
entry_short
,
path
));
path
=
((
struct
entry_short
*
)
mem
)
->
path
;
disk_size
-=
offsetof
(
struct
entry_short
,
path
);
const
size_t
path_offset
=
offsetof
(
struct
entry_short
,
path
);
memcpy
(
mem
,
&
ondisk
,
path_offset
);
path
=
(
char
*
)
mem
+
path_offset
;
disk_size
-=
path_offset
;
}
if
(
last
)
{
...
...
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