Log

Author Commit Date CI Message
Patrick Steinhardt e38ddc90 2018-07-26T15:41:41 fuzzers: limit maximum pack object count By default, libgit2 allows up to 2^32 objects when downloading a packfile from a remote. For each of these objects, libgit2 will allocate up to two small structs, which in total adds up to quite a lot of memory. As a result, our fuzzers might run out of memory rather quick in case where they receive as input a packfile with such a huge count of objects. Limit the packfile object count to 10M objects. This is sufficiently big to still work with most largish repos (linux.git has around 6M objects as of now), but small enough to not cause the fuzzer to OOM.
Patrick Steinhardt 5db64e2f 2018-07-19T14:52:02 fuzzers: convert download_refs fuzzer to C Convert the "download_refs" fuzzer from C++ to C. Rename the source file to have it be picked up by our build system.
Patrick Steinhardt de53972f 2018-07-20T11:07:47 fuzzers: avoid use of libgit2 internals in packfile_raw The packfile_raw fuzzer is using some internal APIs from libgit2, which makes it hard to compile it as part of the oss-fuzz project. As oss-fuzz requires us to link against the C++ FuzzingEngine library, we cannot use "-DBUILD_FUZZERS=ON" directly but instead have to first compile an object from our fuzzers and then link against the C++ library. Compiling the fuzzer objects thus requires an external invocation of CC, and we certainly don't want to do further black magic by adding libgit2's private source directory to the header include path. To fix the issue, convert the code to not use any internal APIs. Besides some headers which we have to add now, this also requires us to change to the hashing function of the ODB. Note that this will change the hashing result, as we have previously not prepended the object header to the data that is to be hashed. But this shouldn't matter in practice, as we don't care for the hash value anyway.
Patrick Steinhardt 186a7ba5 2018-07-19T15:13:40 cmake: error out if required C flags are not supported We do want to notify users compiling our source code early on if they try to use C flags which aren't supported. Add a new macro `AddCFlag`, which results in a fatal error in case the flag is not supported, and use it for our fuzzing flags.
Patrick Steinhardt 07cf8b38 2018-07-20T09:03:10 cmake: use C90 standard for our fuzzing targets Like all our other internal code, we want to force the use of C90 for our fuzzers. Do so by setting the "C_STANDARD" property of our fuzzing targets.
Patrick Steinhardt 12804c46 2018-07-20T12:24:08 cmake: remove USE_SANITIZER and USE_COVERAGE options Both the USE_SANITIZER and USE_COVERAGE options are convenience options that turn on a set of CFLAGS. Despite our own set of CFLAGS required to build libgit2, we have no real business to mess with them, though, as they can easily be passed in by the user via specifying the CFLAGS environment variable. The reasoning behind not providing them is that as soon as we start adding those for some usecases, users might ask for other sets of CFLAGS catering to their specific need in another usecase. Thus, we do not want to support them here.
Patrick Steinhardt ad087303 2018-07-20T14:20:07 fuzzers: move readme to docs/fuzzing.md
Patrick Steinhardt 59328ed8 2018-07-19T13:29:46 fuzzers: rename "fuzz" directory to match our style Our layout uses names like "examples" or "tests" which is why the "fuzz" directory doesn't really fit in here. Rename the directory to be called "fuzzers" instead. Furthermore, we rename the fuzzer "fuzz_packfile_raw" to "packfile_raw_fuzzer", which is also in line with the already existing fuzzer at google/oss-fuzz. While at it, rename the "packfile_raw" fuzzer to instead just be called "packfile" fuzzer.
Patrick Steinhardt 730c0edb 2018-07-19T14:21:35 fuzzers: import download_refs fuzzer from oss-fuzz This is a direct copy of the code from google/oss-fuzz, written by Nelson Elhage (@nelhage). Note that due to the ".cc" ending, the file will not yet be picked up by the build system. This is intended, as currently that file is partly written in C++, requiring a conversion to C.
Patrick Steinhardt ad0cb297 2018-07-20T12:17:42 cmake: fix the unholy options alignment mess
Patrick Steinhardt bf3382d5 2018-07-19T15:22:18 cmake: remove need to add "-fsanitize=fuzzer" flag for fuzzers Right now, users are being instrucded to add the "-DCMAKE_EXE_LINKER_FLAGS=-fsanitize=fuzzer" flag when they want to build our fuzzers. This is error-prone and user unfriendly. Instead, just add the flag to our fuzzers' build instructions so that it happens automatically. Adjust the README accordingly.
lhchavez 60e610a2 2018-01-04T15:36:22 fuzzers: add build support and instructions This change adds support for building a fuzz target for exercising the packfile parser, as well as documentation. It also runs the fuzzers in Travis to avoid regressions.
Edward Thomson 0cf75467 2018-08-02T21:01:10 Merge pull request #4746 from libgit2/ethomson/ci ci: run VSTS builds on master and maint branches
Edward Thomson cd788314 2018-08-02T20:43:21 ci: run VSTS builds on master and maint branches
Edward Thomson ba55592f 2018-08-02T20:34:56 Merge pull request #4743 from Agent00Log/dev/winbugfixes Windows: default credentials / fallback credential handling
Edward Thomson 209c3fe1 2018-08-02T16:42:59 Merge pull request #4745 from libgit2/ethomson/vsts-build-badge ci: add VSTS build badge to README
Edward Thomson a1ae41b8 2018-08-02T14:57:54 ci: add VSTS build badge to README
Edward Thomson 7bed2f34 2018-08-02T15:53:42 Merge pull request #4744 from libgit2/ethomson/travis ci: set PKG_CONFIG_PATH for travis
Edward Thomson abf53363 2018-08-02T14:47:03 ci: set PKG_CONFIG_PATH on travis Homebrew's formula for openssl is "keg-only", which means it does not install it into /usr/local. On macOS builds, we need to set PKG_CONFIG_PATH to include it.
Edward Thomson 5d0070e1 2018-08-02T14:23:23 Merge pull request #4723 from libgit2/ethomson/ci CI: Refactor and introduce VSTS builds
Henning Schaffaf ccbffbae 2018-07-30T13:39:21 Only unitialize if the call to CoInitializeEx was successful
Edward Thomson 4ad108d1 2018-07-30T10:32:01 Merge pull request #4742 from neithernut/revwalk-remove_tautological_condition revwalk: remove tautologic condition for hiding a commit
Edward Thomson d076db11 2018-07-29T17:26:44 ci: run coverity from a nightly VSTS build
Edward Thomson 6b92368c 2018-07-28T22:29:53 ci: run coverity from travis's cron Instead of trying to run coverity builds during the regular PR process, run them during a regularly scheduled cron process. These only need to run nightly, so it makes sense to bring them out of the PR process.
Julian Ganz a4ffbae4 2018-07-29T11:46:05 revwalk: remove tautologic condition for hiding a commit The contition cannot be reached with `commit->uninteresting` being true: either a `break` or a `continue` statement will be hit in this case.
Edward Thomson 24d17562 2018-07-27T16:40:44 ci: remove unused old ci scripts
Edward Thomson 24b8dd82 2018-07-27T12:31:32 ci: move travis to the new scripts
Edward Thomson b00a09b0 2018-07-27T20:14:27 Merge pull request #4731 from libgit2/ethomson/wintls_fix winhttp: retry erroneously failing requests
Edward Thomson 465f8b51 2018-07-26T15:14:37 ci: move appveyor to new scripts
Edward Thomson f7bb4ff8 2018-07-26T15:06:01 ci: use a single setup script for mingw
Edward Thomson 6fb63c92 2018-07-26T14:29:41 ci: use docker containers from libgit2 account
Edward Thomson dc6e80e2 2018-07-26T14:04:19 ci: perform clang builds on Linux
Edward Thomson 6eb97b6b 2018-07-25T01:04:55 ci: dissociate test from leaks process The leaks process is not good about handling children. Ensure that its child is `nohup`ed so that the grandparent shell won't wait for it to exit.
Edward Thomson 230eeda8 2018-07-21T10:49:23 ci: some additional debugging
Edward Thomson b00672b9 2018-07-20T19:47:40 ci: enable leak checking on osx
Edward Thomson afecd15c 2018-07-20T18:09:38 ci: msvc leak-checking
Edward Thomson 7f12c123 2018-07-20T17:20:15 ci: xcode leaks leak-checking
Edward Thomson 219512e7 2018-07-20T14:14:16 buf tests: allocate a smaller size for the oom On Linux (where we run valgrind) allocate a smaller buffer, but still an insanely large size. This will cause malloc to fail but will not cause valgrind to report a likely error with a negative-sized malloc. Keep the original buffer size on non-Linux platforms: this is well-tested on them and changing it may be problematic. On macOS, for example, using the new size causes `malloc` to print a warning to stderr.
Edward Thomson 6d6700d2 2018-07-20T19:01:55 ci: valgrind leak-checking
Edward Thomson 67f5304f 2018-07-14T12:42:50 ci: introduce vsts builds
Patrick Steinhardt 42f83840 2018-07-26T15:25:44 Merge pull request #4721 from nelhage/max-objects Add a configurable limit to the max pack size that will be indexed
Edward Thomson 9e588060 2018-07-14T13:03:16 ci: scripts to setup mingw build environment
Edward Thomson 87342404 2018-07-14T12:35:02 ci: set up a macos host Script to set up dependencies on a macOS build system.
Edward Thomson 5bb2087b 2018-07-14T12:34:05 ci: setup a linux host Sets up a linux host to prepare for a build.
Edward Thomson 451b0017 2018-07-14T12:25:32 ci: improved flexibility for citest.sh Refactor citest.sh to enable local testing by developers.
Edward Thomson bf418f09 2018-07-14T12:24:40 ci: refactor unix ci build/test scripts
Edward Thomson e2cc5b6d 2018-07-14T12:22:47 ci: move tests into citest.ps1 Add citest.ps1 PowerShell script to run the tests.
Edward Thomson 3b6281fa 2018-07-14T12:22:16 ci: Windows PowerShell build script
Edward Thomson ce798b25 2018-07-04T10:56:56 tests: simplify cmake test configuration Simplify the names for the tests, removing the unnecessary "libgit2-clar" prefix. Make "all" the new default test run, and include the online tests by default (since HTTPS should always be enabled). For the CI tests, create an offline-only test, then the various online tests.
Edward Thomson 7d3930a1 2018-07-26T11:15:23 Merge pull request #4739 from pks-t/pks/mbedtls-unused-variable mbedtls: remove unused variable "cacert"
Patrick Steinhardt d4198d4d 2018-07-26T12:11:34 mbedtls: remove unused variable "cacert" In commit 382ed1e87 (mbedtls: load default CA certificates, 2018-03-29), the function `git_mbedtls_stream_global_init` was refactored to call out to `git_mbedtls__set_cert_location` instead of setting up the certificates itself. The conversion forgot to remove the now-unused "cacert" variable, which is now only getting declared to be free'd at the end of the function. Remove it.
Henning Schaffaf 8c21cb5c 2018-07-26T09:52:32 Fix fallback credentials: The call to CoInitializeEx fails if it was previously been set to a different mode.
Henning Schaffaf c9dc30ff 2018-07-26T09:52:21 Fix default credentials: The WinHttpSetCredentials auth scheme must only be one of the supported schemes.
Edward Thomson 45a78977 2018-07-23T12:38:40 Merge pull request #4732 from libgit2/ethomson/leaks Squash some leaks
Edward Thomson 2fabb622 2018-07-21T01:36:46 mbedtls: free stream on shutdown
Edward Thomson 9e002cd5 2018-07-21T01:11:58 mbedtls: make ciphers_list a static array Instead of allocating the ciphers_list, make it a static array. This prevents us from leaking it or having to manage its memory.
Edward Thomson 4e62d26f 2018-07-21T00:45:24 mbedtls: free ciphers_list
Edward Thomson defa9709 2018-07-21T00:41:38 mbedtls: check allocations
Edward Thomson d285de73 2018-07-20T21:52:24 push tests: deeply free the specs Don't just free the spec vector, also free the specs themselves.
Edward Thomson dad99881 2018-07-20T21:51:36 push tests: deeply free the push status Don't just free the push status structure, actually free the strings that were strdup'd into the struct as well.
Edward Thomson ca2eb460 2018-07-20T21:50:58 smart subtransport: free url when resetting stream Free the url field when resetting the stream to avoid leaking it.
Nelson Elhage 32810348 2018-07-20T08:43:54 Use UINT32_MAX as the default object limit This replicates the old behavior of limiting to 2³² by default.
Edward Thomson dc371e3c 2018-07-20T08:20:48 winhttp: retry erroneously failing requests Early Windows TLS 1.2 implementations have an issue during key exchange with OpenSSL implementations that cause negotiation to fail with the error "the buffer supplied to a function was too small." This is a transient error on the connection, so when that error is received, retry up to 5 times to create a connection to the remote server before actually giving up.
Patrick Steinhardt ea9e2c1a 2018-07-20T13:06:56 Merge pull request #4692 from tiennou/examples/checkout Add a checkout example
Patrick Steinhardt 0652abaa 2018-07-20T12:56:49 Merge pull request #4702 from tiennou/fix/coverity Assorted Coverity fixes
Patrick Steinhardt fa401a32 2018-07-19T08:20:04 Merge pull request #4704 from nelhage/no-pkt-pack Remove GIT_PKT_PACK entirely
Etienne Samson b24202e1 2018-07-07T12:52:24 examples: add checkout
Edward Thomson 99bb98c0 2018-07-16T11:18:13 Merge pull request #4722 from boogisha/path-is-ignored-git-analogy ignore: improve `git_ignore_path_is_ignored` description Git analogy
Nelson Elhage b3ca817e 2018-07-16T03:14:33 INDEXER_MAX_OBJECTS -> PACK_MAX_OBJECTS
Nelson Elhage bfe34242 2018-07-16T03:12:01 See if this fixes 32-bit build
Carlos Martín Nieto ee3baed1 2018-07-15T19:28:22 Merge pull request #4724 from libgit2/cmn/allocator-init-order alloc: don't overwrite allocator during init if set
Nelson Elhage 388149f5 2018-07-15T17:25:26 No need for this placeholder.
Carlos Martín Nieto 19007b19 2018-07-15T17:30:04 alloc: don't overwrite allocator during init if set If the allocator has been set before we the library is initialised, we would replace that setting with the standard allocator contrary to the user's wishes.
Edward Thomson 2510268a 2018-07-14T14:00:26 Merge pull request #4700 from pks-t/pks/std-c90 C90 standard compliance
Igor Djordjevic 9cab93c0 2018-07-13T21:29:01 ignore: improve `git_ignore_path_is_ignored` description Git analogy In attempt to provide adequate Git command analogy in regards to ignored files handling, `git_ignore_path_is_ignored` description mentions doing `git add .` on directory containing the file, and whether the file in question would be added or not - but behavior of the two matches for untracked files only, making the comparison misleading in general sense. For tracked files, Git doesn't subject them to ignore rules, so even if a rule applies, `git add .` would actually add the tracked file changes to index, while `git_ignore_path_is_ignored` would still consider the file being ignored (as it doesn't check the index, as documented). Let's provide `git check-ignore --no-index` as analogous Git command example instead, being more aligned with what `git_ignore_path_is_ignored` is about, no matter if the file in question is already tracked or not. See issue #4720 (git_ignore_path_is_ignored documentation misleading?, 2018-07-10)[1] for additional information. [1] https://github.com/libgit2/libgit2/issues/4720
Patrick Steinhardt e1a4a8eb 2018-06-25T11:58:34 cmake: enforce C90 standard While the aim of libgit2 was to conform to C90 code, we never instructed the compiler to enforce C90 compliance. Thus, quite a few violations were able to get into our code base, which have been removed with the previous commits. As we are now able to build libgit2 with C90 enforced, we can set the C_STANDARD property for our own build targets. Note that we explicitly avoid setting the C standard for our third-party dependencies. At least the zlib target does not build with C90 enforced, and we do not want to fix them by deviating from upstream. Thus we simply enforce no standard for them.
Patrick Steinhardt d19381e2 2018-06-25T14:57:07 mbedtls: fix `inline` being used in mbedtls headers The mbedtls headers make direct use of the `inline` attribute to instruct the compiler to inline functions. As this function is not C90 compliant, this can cause the compiler to error as soon as any of these files is included and the `-std=c90` flag is being added. The mbedtls headers declaring functions as inline always have a prelude which define `inline` as a macro in case it is not yet defined. Thus, we can easily replace their define with our own define, which simply copies the logic of our own `GIT_INLINE` macro.
Patrick Steinhardt c13e56f9 2018-06-25T14:12:53 cmake: distinguish internal and system include directories While we want to enforce strict C90 mode, this may cause issues with system provided header files which are themselves not strictly conforming. E.g. if a system header has C++ style comments, a compiler in strict C90 mode would produce an error and abort the build. As the user most likely doesn't want to change the system header, this would completely break the build on such systems. One example of this is mbedtls, which provides such header files. The problem can be worked around by distinguishing between system-provided and project-provided include directories. When adding include directories via "-isystem" instead of "-I", the compiler will skip certain checks and print out less warnings. To use system includes, we can simply add the "SYSTEM" flag to CMake's `INCLUDE_DIRECTORIES` and `TARGET_INCLUDE_DIRECTORIES` functions. Note that we have to split the include directories into two variables because of this, as we definitely still want to check for all warnings produced by our own header files.
Patrick Steinhardt 9994cd3f 2018-06-25T11:56:52 treewide: remove use of C++ style comments C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
Patrick Steinhardt f347a441 2018-06-25T11:55:13 treewide: avoid use of `inline` attribute ISO C90 does not specify the `inline` attribute, and as such we cannot use it in our code. While we already use `__inline` when building in Microsoft Visual Studio, we should also be using the `__inline__` attribute from GCC/Clang. Otherwise, if we're using neither MSVC nor GCC/Clang, we should simply avoid using `inline` at all and just define functions as static. This commit adjusts our own `GIT_INLINE` macro as well as the inline macros specified by khash and xdiff. This allows us to enable strict C90 mode in a later commit.
Nelson Elhage efe3f37d 2018-07-12T04:20:15 Add a git_libgit2_opts option to set the max indexer object count
Nelson Elhage 912c59c9 2018-06-24T06:51:08 while fuzzing, limit # objects read
Edward Thomson 6dfc8bc2 2018-07-09T23:10:05 Merge pull request #4719 from pks-t/pks/delta-oob Delta OOB access
Edward Thomson 290292b4 2018-07-08T15:28:50 Merge pull request #4710 from pks-t/pks/ssl-init-errors streams: report OpenSSL errors if global init fails
Etienne Samson 5b7ba786 2018-06-23T15:45:04 examples: add a helper for boolean-style options
Etienne Samson 8e063eb6 2018-06-23T15:44:35 examples: make the refish resolution work with short OIDs
Etienne Samson 8a629afe 2018-01-31T00:02:00 examples: move refish resolution function in common
Etienne Samson 698b4463 2018-06-23T13:06:10 annotated_commit: make the refname accessible As git_annotated_commit seems to behave like cgit's refish, it's quite helpful to abstract away "targets" via git_annotated_commit_from_id/from_ref. As the former is accessible via git_annotated_commit_id, make the latter also available to users.
Etienne Samson 89091d36 2018-07-06T20:24:21 tests: fix a relative pathname issue The path given to `git_index_add_bypath` is relative to the root of the repository. That `describe/file` path is relative to the root of the sandbox directory, hence if I add the missing `cl_git_pass` I rightfully get an error that `$SANDBOX/describe/describe/file doesn't exist`. The path is thus changed to be made relative to the repository, which makes the failure go away and "restore" the test.
Etienne Samson 8455a270 2018-07-01T12:04:27 tests: add missing cl_git_pass to tests Reported by Coverity, CID 1393678-1393697.
Etienne Samson 6ae6491e 2018-07-06T22:24:16 smart: don't dereference a NULL pkt pointer By clarifying what detect_caps returns on empty/missing packet, we can be sure there are actually refs to process. The old code could blindly dereference `first`, which might have been NULL. Reported by Coverity, CID 1393614
Etienne Samson 68c7480a 2018-07-06T20:21:25 smart: clarify error handling in git_smart__connect
Etienne Samson 36a5b557 2018-06-19T20:18:26 submodule: don't leak memory when failing to insert the names Reported by Coverity, CID 1393237
Etienne Samson 17bd3b96 2018-06-19T20:15:49 tests: mailmap/parsing: add a missing cl_git_pass Reported by Coverity, CID 1393483
Etienne Samson ca9bbcb5 2018-06-19T20:15:02 blame: check error code when loading the mailmap Reported by Coverity, CID 1393484
Edward Thomson f4633791 2018-07-06T12:36:05 Merge pull request #4687 from tiennou/fix/4672 patch_parse: populate line numbers while parsing diffs
Patrick Steinhardt f2a1cece 2018-07-06T11:25:47 Merge pull request #4686 from tiennou/fix/more-worktree-from-bare Fix git_worktree_validate failing on bare repositories
Patrick Steinhardt 8a00de08 2018-07-06T10:47:06 Merge pull request #4699 from nelhage/fetch-null-dst git_refspec_transform: Handle NULL dst
Patrick Steinhardt 75395c87 2018-06-29T13:35:14 streams: report OpenSSL errors if global init fails In case when the global initialization of the OpenSSL stream fails, the user is left without any hint as to what went wrong as we do not provide any error message at all. This commit refactors the init function to have a common error path, which now also sets an error message including the error string provided by OpenSSL.
Patrick Steinhardt e087c0de 2018-07-05T13:30:46 delta: fix overflow when computing limit When checking whether a delta base offset and length fit into the base we have in memory already, we can trigger an overflow which breaks the check. This would subsequently result in us reading memory from out of bounds of the base. The issue is easily fixed by checking for overflow when adding `off` and `len`, thus guaranteeting that we are never indexing beyond `base_len`. This corresponds to the git patch 8960844a7 (check patch_delta bounds more carefully, 2006-04-07), which adds these overflow checks. Reported-by: Riccardo Schirone <rschiron@redhat.com>