convert: remove erroneous tests for errno == EPIPE
[gitweb.git] / pack-write.c
index 88bc7f9f7d03557b040b7246cab7d10c66ec380d..c057513f12724254afa5a1550bfa9ada9deb943c 100644 (file)
@@ -304,7 +304,8 @@ char *index_pack_lockfile(int ip_out)
  *  - each byte afterwards: low seven bits are size continuation,
  *    with the high bit being "size continues"
  */
-int encode_in_pack_object_header(enum object_type type, uintmax_t size, unsigned char *hdr)
+int encode_in_pack_object_header(unsigned char *hdr, int hdr_len,
+                                enum object_type type, uintmax_t size)
 {
        int n = 1;
        unsigned char c;
@@ -315,6 +316,8 @@ int encode_in_pack_object_header(enum object_type type, uintmax_t size, unsigned
        c = (type << 4) | (size & 15);
        size >>= 4;
        while (size) {
+               if (n == hdr_len)
+                       die("object size is too enormous to format");
                *hdr++ = c | 0x80;
                c = size & 0x7f;
                size >>= 7;