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
3847522e
Unverified
Commit
3847522e
authored
Jun 22, 2022
by
Edward Thomson
Committed by
GitHub
Jun 22, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6303 from zawata/legacy_buffer_stream_segfault
filter: Fix Segfault
parents
f98dd543
f887fd60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
src/libgit2/filter.c
+30
-0
No files found.
src/libgit2/filter.c
View file @
3847522e
...
...
@@ -893,6 +893,17 @@ static int buffered_stream_write(
return
git_str_put
(
&
buffered_stream
->
input
,
buffer
,
len
);
}
#ifndef GIT_DEPRECATE_HARD
# define BUF_TO_STRUCT(b, s) \
(b)->ptr = (s)->ptr; \
(b)->size = (s)->size; \
(b)->reserved = (s)->asize;
# define STRUCT_TO_BUF(s, b) \
(s)->ptr = (b)->ptr; \
(s)->size = (b)->size; \
(s)->asize = (b)->reserved;
#endif
static
int
buffered_stream_close
(
git_writestream
*
s
)
{
struct
buffered_stream
*
buffered_stream
=
(
struct
buffered_stream
*
)
s
;
...
...
@@ -902,6 +913,25 @@ static int buffered_stream_close(git_writestream *s)
GIT_ASSERT_ARG
(
buffered_stream
);
#ifndef GIT_DEPRECATE_HARD
if
(
buffered_stream
->
write_fn
==
NULL
)
{
git_buf
legacy_output
=
GIT_BUF_INIT
,
legacy_input
=
GIT_BUF_INIT
;
BUF_TO_STRUCT
(
&
legacy_output
,
buffered_stream
->
output
);
BUF_TO_STRUCT
(
&
legacy_input
,
&
buffered_stream
->
input
);
error
=
buffered_stream
->
legacy_write_fn
(
buffered_stream
->
filter
,
buffered_stream
->
payload
,
&
legacy_output
,
&
legacy_input
,
buffered_stream
->
source
);
STRUCT_TO_BUF
(
buffered_stream
->
output
,
&
legacy_output
);
STRUCT_TO_BUF
(
&
buffered_stream
->
input
,
&
legacy_input
);
}
else
#endif
error
=
buffered_stream
->
write_fn
(
buffered_stream
->
filter
,
buffered_stream
->
payload
,
...
...
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