1. 08 5月, 2017 1 次提交
  2. 25 3月, 2017 1 次提交
    • J
      encode_in_pack_object_header: respect output buffer length · 7202a6fa
      Jeff King 提交于
      The encode_in_pack_object_header() writes a variable-length
      header to an output buffer, but it doesn't actually know
      long the buffer is. At first glance, this looks like it
      might be possible to overflow.
      
      In practice, this is probably impossible. The smallest
      buffer we use is 10 bytes, which would hold the header for
      an object up to 2^67 bytes. Obviously we're not likely to
      see such an object, but we might worry that an object could
      lie about its size (causing us to overflow before we realize
      it does not actually have that many bytes). But the argument
      is passed as a uintmax_t. Even on systems that have __int128
      available, uintmax_t is typically restricted to 64-bit by
      the ABI.
      
      So it's unlikely that a system exists where this could be
      exploited. Still, it's easy enough to use a normal out/len
      pair and make sure we don't write too far. That protects the
      hypothetical 128-bit system, makes it harder for callers to
      accidentally specify a too-small buffer, and makes the
      resulting code easier to audit.
      
      Note that the one caller in fast-import tried to catch such
      a case, but did so _after_ the call (at which point we'd
      have already overflowed!). This check can now go away.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7202a6fa
  3. 16 11月, 2016 1 次提交
    • J
      compression: unify pack.compression configuration parsing · 8de7eeb5
      Junio C Hamano 提交于
      There are three codepaths that use a variable whose name is
      pack_compression_level to affect how objects and deltas sent to a
      packfile is compressed.  Unlike zlib_compression_level that controls
      the loose object compression, however, this variable was static to
      each of these codepaths.  Two of them read the pack.compression
      configuration variable, using core.compression as the default, and
      one of them also allowed overriding it from the command line.
      
      The other codepath in bulk-checkin did not pay any attention to the
      configuration.
      
      Unify the configuration parsing to git_default_config(), where we
      implement the parsing of core.loosecompression and core.compression
      and make the former override the latter, by moving code to parse
      pack.compression and also allow core.compression to give default to
      this variable.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8de7eeb5
  4. 26 9月, 2015 1 次提交
    • J
      use xsnprintf for generating git object headers · ef1286d3
      Jeff King 提交于
      We generally use 32-byte buffers to format git's "type size"
      header fields. These should not generally overflow unless
      you can produce some truly gigantic objects (and our types
      come from our internal array of constant strings). But it is
      a good idea to use xsnprintf to make sure this is the case.
      
      Note that we slightly modify the interface to
      write_sha1_file_prepare, which nows uses "hdrlen" as an "in"
      parameter as well as an "out" (on the way in it stores the
      allocated size of the header, and on the way out it returns
      the ultimate size of the header).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ef1286d3
  5. 14 3月, 2015 1 次提交
  6. 06 3月, 2015 1 次提交
  7. 16 9月, 2014 1 次提交
  8. 04 3月, 2014 1 次提交
  9. 21 8月, 2013 1 次提交
  10. 02 12月, 2011 1 次提交