1. 12 Mar, 2018 2 commits
  2. 11 Mar, 2018 1 commit
  3. 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
  4. 08 Mar, 2018 3 commits
  5. 07 Mar, 2018 2 commits
  6. 04 Mar, 2018 2 commits
  7. 03 Mar, 2018 1 commit
  8. 02 Mar, 2018 2 commits
  9. 28 Feb, 2018 11 commits
  10. 27 Feb, 2018 5 commits
  11. 25 Feb, 2018 4 commits
  12. 24 Feb, 2018 4 commits
    • checkout test: ensure workdir mode is simplified · 275693e2
      Ensure that when examining the working directory for checkout that the
      mode is correctly simplified.  Git only pays attention to whether a file
      is executable or not.  When examining a working directory, we should
      coalesce modes in the working directory to either `0755` (indicating
      that a file is executable) or `0644` (indicating that it is not).
      
      Test this by giving the file an exotic mode, and ensuring that when
      checkout out a branch that changes the file's contents, that we do not
      have a checkout conflict.
      Edward Thomson committed
    • checkout test: add core.filemode checkout tests · ec96db57
      Add two tests for filemode.
      
      The first ensures that `core.filemode=true` is honored: if we have
      changed the filemode such that a file that _was_ executable (mode 0755)
      is now executable (mode 0644) and we go to check out a branch that has
      otherwise changed the contents of the file, then we should raise a
      checkout conflict for that file.
      
      The second ensures that `core.filemode=false` is honored: in the same
      situation, we set a file that was executable to be non-executable, and
      check out the branch that changes the contents of the file.  However,
      since `core.filemode` is false, we do not detect the filemode change.
      
      We run these tests on both operating systems that obey `core.filemode`
      (eg, POSIX) and those that have no conception of filemode (eg, Win32).
      This ensures that `core.filemode` is always honored, as it is a cache of
      the underlying filesystem's settings.  This ensures that we do not
      make assumptions based on the operating system, and honor the
      configuration setting even if it were misconfigured.
      Edward Thomson committed
    • testrepo: add new branch · 18d9c847
      Add a new branch to the `testrepo` repository, where the `README` file
      has changed to executable.  This branch enables typechange tests between
      the new `executable` branch and `master`.
      Edward Thomson committed