1. 21 Oct, 2018 2 commits
    • buf::oom tests: use custom allocator for oom failures · 2e34efaa
      Create a custom allocator for the `buf::oom` tests that will fail with
      out-of-memory errors in predictable ways.  We were previously trying to
      guess the way that various allocators on various platforms would fail
      in a way such that `malloc`/`realloc` would return `NULL` (instead of
      aborting the application, or appearing suspicious to various
      instrumentation or static code analysis tools like valgrind.)
      
      Introduce a fake `malloc` and `realloc` that will return `NULL` on
      allocations requesting more than 100 bytes.  Otherwise, we proxy to the
      default allocator.  (It's important to use the _default_ allocator, not
      just call `malloc`, since the default allocator on Windows CI builds may
      be the debugging C runtime allocators which would not be compatible with
      a standard `malloc`.)
      Edward Thomson committed
    • tests: don't run buf::oom on 32-bit systems · 415a8ae9
      On a 32-bit Linux systems, the value large enough to make malloc
      guarantee a failure is also large enough that valgrind considers it
      "fishy".  Skip this test on those systems entirely.
      Edward Thomson committed
  2. 20 Oct, 2018 1 commit
    • checkout: fix test fixture missing objects · c79e6081
      The testrepo test fixture has an index file that's damaged, missing an
      object.  The index previously had an entry of `src/index.c` with id
      3161df8cbf3a006b4ef85be6497a0ea6bde98541, but that object was missing in
      the repository.  This commit adds an object to the repository and
      updates the index to use that existing blob.
      
      Similarly, the index has an entry for `readme` with an id of
      97328ac7e3bd0bcd3900cb3e7a624d71dd0df888.  This can be restored from
      other test repositories.
      
      With these fixed, now the write tree from index tests can pass since they
      validate object existence.
      Edward Thomson committed
  3. 19 Oct, 2018 2 commits
  4. 15 Oct, 2018 1 commit
  5. 09 Oct, 2018 1 commit
  6. 08 Oct, 2018 1 commit
  7. 05 Oct, 2018 6 commits
  8. 04 Oct, 2018 3 commits
  9. 03 Oct, 2018 4 commits
    • smart_pkt: reorder and rename parameters of `git_pkt_parse_line` · 0b3dfbf4
      The parameters of the `git_pkt_parse_line` function are quite confusing.
      First, there is no real indicator what the `out` parameter is actually
      all about, and it's not really clear what the `bufflen` parameter refers
      to. Reorder and rename the parameters to make this more obvious.
      Patrick Steinhardt committed
    • smart_pkt: fix buffer overflow when parsing "ok" packets · a9f1ca09
      There are two different buffer overflows present when parsing "ok"
      packets. First, we never verify whether the line already ends after
      "ok", but directly go ahead and also try to skip the expected space
      after "ok". Second, we then go ahead and use `strchr` to scan for the
      terminating newline character. But in case where the line isn't
      terminated correctly, this can overflow the line buffer.
      
      Fix the issues by using `git__prefixncmp` to check for the "ok " prefix
      and only checking for a trailing '\n' instead of using `memchr`. This
      also fixes the issue of us always requiring a trailing '\n'.
      
      Reported by oss-fuzz, issue 9749:
      
      Crash Type: Heap-buffer-overflow READ {*}
      Crash Address: 0x6310000389c0
      Crash State:
        ok_pkt
        git_pkt_parse_line
        git_smart__store_refs
      
      Sanitizer: address (ASAN)
      Patrick Steinhardt committed
    • smart_pkt: fix buffer overflow when parsing "ACK" packets · bc349045
      We are being quite lenient when parsing "ACK" packets. First, we didn't
      correctly verify that we're not overrunning the provided buffer length,
      which we fix here by using `git__prefixncmp` instead of
      `git__prefixcmp`. Second, we do not verify that the actual contents make
      any sense at all, as we simply ignore errors when parsing the ACKs OID
      and any unknown status strings. This may result in a parsed packet
      structure with invalid contents, which is being silently passed to the
      caller. This is being fixed by performing proper input validation and
      checking of return codes.
      Patrick Steinhardt committed
    • tests: verify parsing logic for smart packets · 365d2720
      The commits following this commit are about to introduce quite a lot of
      refactoring and tightening of the smart packet parser. Unfortunately, we
      do not yet have any tests despite our online tests that verify that our
      parser does not regress upon changes. This is doubly unfortunate as our
      online tests aren't executed by default.
      
      Add new tests that exercise the smart parsing logic directly by
      executing `git_pkt_parse_line`.
      Patrick Steinhardt committed
  10. 30 Sep, 2018 1 commit
  11. 28 Sep, 2018 2 commits
    • config: introduce new read-only in-memory backend · 2be39cef
      Now that we have abstracted away how to store and retrieve config
      entries, it became trivial to implement a new in-memory backend by
      making use of this. And thus we do so.
      
      This commit implements a new read-only in-memory backend that can parse
      a chunk of memory into a `git_config_backend` structure.
      Patrick Steinhardt committed
    • config: rename "config_file.h" to "config_backend.h" · b944e137
      The header "config_file.h" has a list of inline-functions to access the
      contents of a config backend without directly messing with the struct's
      function pointers. While all these functions are called
      "git_config_file_*", they are in fact completely backend-agnostic and
      don't care whether it is a file or not. Rename all the function to
      instead be backend-agnostic versions called "git_config_backend_*" and
      rename the header to match.
      Patrick Steinhardt committed
  12. 26 Sep, 2018 1 commit
  13. 25 Sep, 2018 1 commit
  14. 22 Sep, 2018 1 commit
  15. 10 Sep, 2018 1 commit
  16. 08 Sep, 2018 1 commit
  17. 06 Sep, 2018 9 commits
  18. 24 Aug, 2018 1 commit
  19. 19 Aug, 2018 1 commit