libgit2/tests/filter
Patrick Steinhardt cf07db2f1b filter: only close filter if it's been initialized correctly
In the function `git_filter_list_stream_data`, we initialize, write and
subesquently close the stream which should receive content processed by
the filter. While we skip writing to the stream if its initialization
failed, we still try to close it unconditionally -- even if the
initialization failed, where the stream might not be set at all, leading
us to segfault.

Semantics in this code is not really clear. The function handling the
same logic for files instead of data seems to do the right thing here in
only closing the stream when initialization succeeded. When stepping
back a bit, this is only reasonable: if a stream cannot be initialized,
the caller would not expect it to be closed again. So actually, both
callers of `stream_list_init` fail to do so. The data streaming function
will always close the stream and the file streaming function will not
close the stream if writing to it has failed.

The fix is thus two-fold:

- callers of `stream_list_init` now close the stream iff it has been
  initialized
- `stream_list_init` now closes the lastly initialized stream if
  the current stream in the chain failed to initialize

Add a test which segfaulted previous to these changes.
2017-04-07 16:34:47 +02:00
..
blob.c Fix ident replacement to match Git behavior 2015-05-26 19:56:06 +02:00
crlf.c crlf tests: ensure that Unix obeys autocrlf=true 2015-06-22 12:00:26 -04:00
crlf.h Add files and tests with many UTF-8 chars and few UTF-8 chars 2015-01-20 16:17:48 -06:00
custom_helpers.c filter: only close filter if it's been initialized correctly 2017-04-07 16:34:47 +02:00
custom_helpers.h filter: only close filter if it's been initialized correctly 2017-04-07 16:34:47 +02:00
custom.c filter: only close filter if it's been initialized correctly 2017-04-07 16:34:47 +02:00
file.c filter test: pass base type 2015-06-29 22:13:40 +00:00
ident.c Fix ident replacement to match Git behavior 2015-05-26 19:56:06 +02:00
query.c Introduce git_filter_list_contains 2015-06-10 14:43:49 -04:00
stream.c Merge pull request #3288 from ethomson/getenv 2015-07-07 00:48:17 +02:00
wildcard.c wildcard filters: move CHANGELOG message to 0.23+1 2015-07-10 09:53:30 -05:00