1. 24 Nov, 2019 7 commits
  2. 23 Nov, 2019 2 commits
  3. 22 Nov, 2019 1 commit
  4. 16 Nov, 2019 3 commits
  5. 10 Nov, 2019 1 commit
    • patch_parse: use paths from "---"/"+++" lines for binary patches · de7659cc
      For some patches, it is not possible to derive the old and new file
      paths from the patch header's first line, most importantly when they
      contain spaces. In such a case, we derive both paths from the "---" and
      "+++" lines, which allow for non-ambiguous parsing. We fail to use these
      paths when parsing binary patches without data, though, as we always
      expect the header paths to be filled in.
      
      Fix this by using the "---"/"+++" paths by default and only fall back to
      header paths if they aren't set. If neither of those paths are set, we
      just return an error. Add two tests to verify this behaviour, one of
      which would have previously caused a segfault.
      Patrick Steinhardt committed
  6. 09 Nov, 2019 1 commit
  7. 06 Nov, 2019 3 commits
  8. 05 Nov, 2019 10 commits
  9. 02 Nov, 2019 1 commit
  10. 01 Nov, 2019 2 commits
  11. 30 Oct, 2019 2 commits
  12. 29 Oct, 2019 1 commit
  13. 26 Oct, 2019 1 commit
  14. 24 Oct, 2019 2 commits
  15. 22 Oct, 2019 1 commit
  16. 21 Oct, 2019 1 commit
    • patch_parse: detect overflow when calculating old/new line position · 37141ff7
      When the patch contains lines close to INT_MAX, then it may happen that
      we end up with an integer overflow when calculating the line of the
      current diff hunk. Reject such patches as unreasonable to avoid the
      integer overflow.
      
      As the calculation is performed on integers, we introduce two new
      helpers `git__add_int_overflow` and `git__sub_int_overflow` that perform
      the integer overflow check in a generic way.
      Patrick Steinhardt committed
  17. 19 Oct, 2019 1 commit
    • patch_parse: fix out-of-bounds read with No-NL lines · 468e3ddc
      We've got two locations where we copy lines into the patch. The first
      one is when copying normal " ", "-" or "+" lines, while the second
      location gets executed when we copy "\ No newline at end of file" lines.
      While the first one correctly uses `git__strndup` to copy only until the
      newline, the other one doesn't. Thus, if the line occurs at the end of
      the patch and if there is no terminating NUL character, then it may
      result in an out-of-bounds read.
      
      Fix the issue by using `git__strndup`, as was already done in the other
      location. Furthermore, add allocation checks to both locations to detect
      out-of-memory situations.
      Patrick Steinhardt committed