Commit Graph

9176 Commits

Author SHA1 Message Date
Patrick Steinhardt
1a16e8b057 pack-objects: fix memory leak on overflow 2016-04-11 15:58:55 -04:00
Patrick Steinhardt
e114bbac89 index: assert required OID are non-NULL 2016-04-11 15:58:55 -04:00
Patrick Steinhardt
d0780b8133 object: avoid call of memset with ouf of bounds pointer
When computing a short OID we do this by first copying the
leading parts into the new OID structure and then setting the
trailing part to zero. In the case of the desired length being
`GIT_OID_HEXSZ - 1` we will call `memset` with an out of bounds
pointer and a length of 0. While this seems to cause no problems
for common platforms the C89 standard does not explicitly state
that calling `memset` with an out of bounds pointer and
length of 0 is valid.

Fix the potential issue by using the newly introduced
`git_oid__cpy_prefix` function.
2016-04-11 15:58:55 -04:00
Edward Thomson
fa4b93a61c backport git_oid__cpy_prefix 2016-04-11 15:58:54 -04:00
Patrick Steinhardt
faf823dcca tests: transport: fix memory leaks with registering transports 2016-04-11 14:15:28 -04:00
Piet Brauer
0370dae1ad Check for __CLANG_INTTYPES_H
This fixes an issue in Xcode 7.3 in objective-git where we get the error
"Include of non-modular header file in module". Not importing this
header again fixes the issue.
2016-04-11 14:14:32 -04:00
Patrick Steinhardt
e39ad747f7 config_file: handle missing quotation marks in section header
When parsing a section header we expect something along the
format of '[section "subsection"]'. When a section is
mal-formated and is entirely missing its quotation marks we catch
this case by observing that `strchr(line, '"') - strrchr(line,
'"') = NULL - NULL = 0` and error out. Unfortunately, the error
message is misleading though, as we state that we are missing the
closing quotation mark while we in fact miss both quotation
marks.

Improve the error message by explicitly checking if the first
quotation mark could be found and, if not, stating that quotation
marks are completely missing.
2016-04-11 14:14:25 -04:00
Patrick Steinhardt
ffb1f41949 describe: handle error code returned by git_pqueue_insert 2016-04-11 14:14:15 -04:00
Carlos Martín Nieto
4ebf745f06 mwindow: free unused windows if we fail to mmap
The first time may be due to memory fragmentation or just bad luck on a
32-bit system. When we hit the mmap error for the first time, free up
the unused windows and try again.
2016-04-11 14:13:34 -04:00
Chris Hescock
9ee498e800 Only buffer if necessary. 2016-04-11 14:13:11 -04:00
Edward Thomson
eb09ead246 odb: improved not found error messages
When looking up an abbreviated oid, show the actual (abbreviated) oid
the caller passed instead of a full (but ambiguously truncated) oid.
2016-04-11 14:12:40 -04:00
P.S.V.R
cdded6309a Remove duplicated calls to git_mwindow_close 2016-04-11 14:11:55 -04:00
Chris Hescock
e3862c9fb2 Buffer sideband packet data
The inner packet may be split across multiple sideband packets.
2016-04-11 14:11:51 -04:00
Yong Li
8ec3d88f58 Avoid subtraction overflow in git_indexer_commit 2016-04-11 14:11:41 -04:00
Chris Bargren
4a93a7fcc4 Tabs 2016-04-11 14:11:33 -04:00
Chris Bargren
b8dc15f70e Adding test cases that actually test the functionality of the new transport
ssh, ssh+git and git+ssh should all successfully build an SSH transport
2016-04-11 14:11:28 -04:00
Chris Bargren
e44f6586ce Removing #define for SSH_PREFIX_COUNT and using ARRAY_SIZE instead
Also moving var declarations to top of blocks to support bad old compilers
2016-04-11 14:11:11 -04:00
Chris Bargren
429155d516 Updating change to http_parser to reflect PR for nodejs/http-parser
The parser now also supports digits, '-' and '.'. https://github.com/nodejs/http-parser/pull/276
2016-04-11 14:11:06 -04:00
Chris Bargren
fa8b1a8822 Adding spec coverage for ssh+git and git+ssh protocols 2016-04-11 14:11:00 -04:00
Chris Bargren
ff8e3f0e6b Handle git+ssh:// and ssh+git:// protocols support 2016-04-11 14:10:55 -04:00
Chris Bargren
2f2575c002 Updating http parser to accept a + in the schema 2016-04-11 14:10:51 -04:00
Edward Thomson
785d8c48ea Merge pull request #3653 from libgit2/cmn/treebuilder-submodule
treebuilder: don't try to verify submodules exist in the odb
2016-03-04 13:50:23 +00:00
Carlos Martín Nieto
ea5bf6bbce treebuilder: don't try to verify submodules exist in the odb
Submodules don't exist in the objectdb and the code is making us try to
look for a blob with its commit id, which is obviously not going to
work.

Skip the test if the user wants to insert a submodule.
2016-03-04 12:38:28 +01:00
Edward Thomson
1609983377 Merge pull request #3651 from libgit2/cmn/init-libssh2
ssh: initialize libssh2
2016-03-03 22:57:45 +00:00
Carlos Martín Nieto
22f3d3aa6b ssh: initialize libssh2
We should have been doing this, but it initializes itself upon first
use, which works as long as nobody's doing concurrent network
operations. Initialize it on our init to make sure it's not getting
initialized concurrently.
2016-03-03 22:26:31 +01:00
Carlos Martín Nieto
839bdb05a0 Merge pull request #3639 from srajko/threading-openssl-libssh2
Expand OpenSSL and libssh2 thread safety documentation
2016-03-03 21:20:33 +01:00
Carlos Martín Nieto
e23efa6ddf tests: take the version from our define 2016-03-03 21:03:10 +01:00
Carlos Martín Nieto
1e8255a39b Bump version to 0.24.0 2016-03-03 20:20:43 +01:00
Carlos Martín Nieto
c21c8f67e8 CHANGELOG: prepre tamplate for release 2016-03-03 20:18:55 +01:00
Carlos Martín Nieto
a7ef27af1c CHANGELOG: add note about WinHTTP cred handling 2016-03-03 20:17:13 +01:00
Carlos Martín Nieto
66a530eb4e Merge pull request #3648 from libgit2/cmn/auth-retry
test: make sure we retry the auth callback on all platforms
2016-03-03 20:11:18 +01:00
Carlos Martín Nieto
ba9bb664f3 tests: create a ctest target for cred_callback 2016-03-03 19:31:02 +01:00
Carlos Martín Nieto
778fb695ed Merge pull request #3646 from pks-t/pks/xdiff-fix-from-upstream
xdiff: fix memleak on error case
2016-03-03 12:14:02 +01:00
Carlos Martín Nieto
a4cba9d453 winhttp: retry authentication
If the caller has provided bad authentication, give them another
apportunity to get it right until they give up. This brings WinHTTP in
line with the other transports.
2016-03-03 11:18:03 +01:00
Carlos Martín Nieto
2520573778 test: make sure we retry the auth callback on all platforms
We were missing this test on Windows, which meant we didn't notice that
we never fixed the single authentication attempt it tries, nor its wrong
return code.

Enable this for the unix platforms as well over HTTP. We previously were
doing it locally but disabled it on OS X due to issues with its sshd not
accepting password authentication.
2016-03-03 11:18:03 +01:00
Carlos Martín Nieto
9b3fc895b7 tests: plug a leak 2016-03-03 11:17:36 +01:00
Edward Thomson
edaffe22a2 Merge pull request #3633 from ethomson/safe_creation
Stricter object dependency checking during creation
2016-03-01 17:16:27 +00:00
Patrick Steinhardt
a4ea7faaad xdiff: fix memleak on error case
Commit 3d1abc5afc fixes a memory leak in the xdiff code. In the
process of upstreaming the fix it was pointed out by Johannes
Schindelin that there is another memory leak present (see [1]).

Fix the second memory leak by applying the upstream fix to our
code base.

[1]: http://thread.gmane.org/gmane.comp.version-control.git/287034
2016-03-01 08:56:23 +01:00
Edward Thomson
dbee683553 Merge pull request #3567 from sba1/few-p_getaddrinfo-fixes
Few p_getaddrinfo fixes
2016-02-28 20:13:24 -05:00
Edward Thomson
f2dddf52c0 turn on strict object validation by default 2016-02-28 18:59:43 -05:00
Edward Thomson
4afe536ba1 tests: use legitimate object ids
Use legitimate (existing) object IDs in tests so that we have the
ability to turn on strict object validation when running tests.
2016-02-28 18:54:56 -05:00
Edward Thomson
98c341496f refs: honor strict object creation 2016-02-28 18:54:39 -05:00
Edward Thomson
3ef01e7727 git_object__is_valid: use odb_read_header
This allows lighter weight validation in `git_object__is_valid` that
does not require reading the entire object.
2016-02-28 18:54:39 -05:00
Edward Thomson
6ddf533afc git_index_add: validate objects in index entries (optionally)
When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the index entries given to `git_index_add`.
2016-02-28 18:54:39 -05:00
Carlos Martín Nieto
1a9d7c95a1 Merge pull request #3644 from ethomson/debug_pool
travis ci: enable debug pool for valgrind builds
2016-02-28 19:43:45 +01:00
Edward Thomson
2bbc7d3e56 treebuilder: validate tree entries (optionally)
When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the tree and parent ids given to treebuilder insertion.
2016-02-28 12:38:40 -05:00
Edward Thomson
ef63bab306 git_commit: validate tree and parent ids
When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the tree and parent ids given to commit creation functions.
2016-02-28 12:38:39 -05:00
Edward Thomson
7565dc6572 git_object__is_valid: simple object validity test 2016-02-28 12:38:39 -05:00
Edward Thomson
22a19f5b57 git_libgit2_opts: introduce GIT_OPT_ENABLE_STRICT_OBJECT_CREATION 2016-02-28 12:38:39 -05:00
Edward Thomson
da03356044 travis ci: enable debug pool for valgrind builds 2016-02-28 11:34:36 -05:00