1. 28 Mar, 2018 2 commits
    • blame_git: fix coalescing step never being executed · 75203d03
      Since blame has been imported from git.git and had its first share of
      refactorings in b6f60a4d (Clean up ported code, 2013-09-21), the code
      is actually not doing the coalescing step of the generated blame. While
      the code to do the coalescing does exist, it is never being called as
      the function `git_blame__like_git` will directly return from its `while
      (true)` loop.
      
      The function that was being imported from git.git was the `assign_blame`
      function from "builtin/blame.c" from 717d1462b (git-blame --incremental,
      2007-01-28), which hasn't really changed much. Upon taking an initial
      look, one can seet hat `coalesce` is actually never getting called in
      `assign_blame`, as well, so one may assume that not calling `coalesce`
      by accident is actually the right thing. But it is not, as `coalesce` is
      being called ever since cee7f245d (git-pickaxe: blame rewritten.,
      2006-10-19) after the blame has been done in the caller of
      `assign_blame`. Thus we can conclude the code of libgit2 is actually
      buggy since forever.
      
      To fix the issue, simply break out of the loop instead of doing a direct
      return. Note that this does not alter behaviour in any way visible to
      our tests, which is unfortunate. But in order to not diverge from what
      git.git does, I'd rather adapt to how it is being done upstream in order
      to avoid breaking certain edge cases than to just remove that code.
      Patrick Steinhardt committed
    • Merge pull request #4598 from cjhoward92/fix/remove-unused-merge-result · 9e8bc726
      types: remove unused git_merge_result
      Patrick Steinhardt committed
  2. 27 Mar, 2018 2 commits
  3. 26 Mar, 2018 2 commits
  4. 23 Mar, 2018 3 commits
  5. 20 Mar, 2018 3 commits
  6. 19 Mar, 2018 11 commits
  7. 13 Mar, 2018 1 commit
  8. 12 Mar, 2018 2 commits
  9. 11 Mar, 2018 1 commit
  10. 10 Mar, 2018 3 commits
    • index: error out on unreasonable prefix-compressed path lengths · 3db1af1f
      When computing the complete path length from the encoded
      prefix-compressed path, we end up just allocating the complete path
      without ever checking what the encoded path length actually is. This can
      easily lead to a denial of service by just encoding an unreasonable long
      path name inside of the index. Git already enforces a maximum path
      length of 4096 bytes. As we also have that enforcement ready in some
      places, just make sure that the resulting path is smaller than
      GIT_PATH_MAX.
      
      Reported-by: Krishna Ram Prakash R <krp@gtux.in>
      Reported-by: Vivek Parikh <viv0411.parikh@gmail.com>
      Patrick Steinhardt committed
    • index: fix out-of-bounds read with invalid index entry prefix length · 3207ddb0
      The index format in version 4 has prefix-compressed entries, where every
      index entry can compress its path by using a path prefix of the previous
      entry. Since implmenting support for this index format version in commit
      5625d86b (index: support index v4, 2016-05-17), though, we do not
      correctly verify that the prefix length that we want to reuse is
      actually smaller or equal to the amount of characters than the length of
      the previous index entry's path. This can lead to a an integer underflow
      and subsequently to an out-of-bounds read.
      
      Fix this by verifying that the prefix is actually smaller than the
      previous entry's path length.
      
      Reported-by: Krishna Ram Prakash R <krp@gtux.in>
      Reported-by: Vivek Parikh <viv0411.parikh@gmail.com>
      Patrick Steinhardt committed
    • index: convert `read_entry` to return entry size via an out-param · 58a6fe94
      The function `read_entry` does not conform to our usual coding style of
      returning stuff via the out parameter and to use the return value for
      reporting errors. Due to most of our code conforming to that pattern, it
      has become quite natural for us to actually return `-1` in case there is
      any error, which has also slipped in with commit 5625d86b (index:
      support index v4, 2016-05-17). As the function returns an `size_t` only,
      though, the return value is wrapped around, causing the caller of
      `read_tree` to continue with an invalid index entry. Ultimately, this
      can lead to a double-free.
      
      Improve code and fix the bug by converting the function to return the
      index entry size via an out parameter and only using the return value to
      indicate errors.
      
      Reported-by: Krishna Ram Prakash R <krp@gtux.in>
      Reported-by: Vivek Parikh <viv0411.parikh@gmail.com>
      Patrick Steinhardt committed
  11. 08 Mar, 2018 3 commits
  12. 07 Mar, 2018 3 commits
  13. 04 Mar, 2018 2 commits
  14. 03 Mar, 2018 1 commit
  15. 02 Mar, 2018 1 commit