Skip to content

Commit 3adc4ec

Browse files
committed
Sync with v2.5.4
2 parents be08dee + 2435856 commit 3adc4ec

29 files changed

+486
-30
lines changed

Documentation/RelNotes/2.3.10.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Git v2.3.10 Release Notes
2+
=========================
3+
4+
Fixes since v2.3.9
5+
------------------
6+
7+
* xdiff code we use to generate diffs is not prepared to handle
8+
extremely large files. It uses "int" in many places, which can
9+
overflow if we have a very large number of lines or even bytes in
10+
our input files, for example. Cap the input size to soemwhere
11+
around 1GB for now.
12+
13+
* Some protocols (like git-remote-ext) can execute arbitrary code
14+
found in the URL. The URLs that submodules use may come from
15+
arbitrary sources (e.g., .gitmodules files in a remote
16+
repository), and can hurt those who blindly enable recursive
17+
fetch. Restrict the allowed protocols to well known and safe
18+
ones.

Documentation/RelNotes/2.4.10.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Git v2.4.10 Release Notes
2+
=========================
3+
4+
Fixes since v2.4.9
5+
------------------
6+
7+
* xdiff code we use to generate diffs is not prepared to handle
8+
extremely large files. It uses "int" in many places, which can
9+
overflow if we have a very large number of lines or even bytes in
10+
our input files, for example. Cap the input size to soemwhere
11+
around 1GB for now.
12+
13+
* Some protocols (like git-remote-ext) can execute arbitrary code
14+
found in the URL. The URLs that submodules use may come from
15+
arbitrary sources (e.g., .gitmodules files in a remote
16+
repository), and can hurt those who blindly enable recursive
17+
fetch. Restrict the allowed protocols to well known and safe
18+
ones.

Documentation/RelNotes/2.5.4.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Git v2.5.4 Release Notes
2+
========================
3+
4+
Fixes since v2.5.4
5+
------------------
6+
7+
* xdiff code we use to generate diffs is not prepared to handle
8+
extremely large files. It uses "int" in many places, which can
9+
overflow if we have a very large number of lines or even bytes in
10+
our input files, for example. Cap the input size to soemwhere
11+
around 1GB for now.
12+
13+
* Some protocols (like git-remote-ext) can execute arbitrary code
14+
found in the URL. The URLs that submodules use may come from
15+
arbitrary sources (e.g., .gitmodules files in a remote
16+
repository), and can hurt those who blindly enable recursive
17+
fetch. Restrict the allowed protocols to well known and safe
18+
ones.

Documentation/git.txt

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ Documentation for older releases are available here:
4848
* release notes for
4949
link:RelNotes/2.6.0.txt[2.6].
5050

51-
* link:v2.5.3/git.html[documentation for release 2.5.3]
51+
* link:v2.5.4/git.html[documentation for release 2.5.4]
5252

5353
* release notes for
54+
link:RelNotes/2.5.4.txt[2.5.4],
5455
link:RelNotes/2.5.3.txt[2.5.3],
5556
link:RelNotes/2.5.2.txt[2.5.2],
5657
link:RelNotes/2.5.1.txt[2.5.1],
5758
link:RelNotes/2.5.0.txt[2.5].
5859

59-
* link:v2.4.9/git.html[documentation for release 2.4.9]
60+
* link:v2.4.10/git.html[documentation for release 2.4.10]
6061

6162
* release notes for
63+
link:RelNotes/2.4.10.txt[2.4.10],
6264
link:RelNotes/2.4.9.txt[2.4.9],
6365
link:RelNotes/2.4.8.txt[2.4.8],
6466
link:RelNotes/2.4.7.txt[2.4.7],
@@ -70,9 +72,10 @@ Documentation for older releases are available here:
7072
link:RelNotes/2.4.1.txt[2.4.1],
7173
link:RelNotes/2.4.0.txt[2.4].
7274

73-
* link:v2.3.9/git.html[documentation for release 2.3.9]
75+
* link:v2.3.10/git.html[documentation for release 2.3.10]
7476

7577
* release notes for
78+
link:RelNotes/2.3.10.txt[2.3.10],
7679
link:RelNotes/2.3.9.txt[2.3.9],
7780
link:RelNotes/2.3.8.txt[2.3.8],
7881
link:RelNotes/2.3.7.txt[2.3.7],
@@ -1092,6 +1095,33 @@ GIT_ICASE_PATHSPECS::
10921095
an operation has touched every ref (e.g., because you are
10931096
cloning a repository to make a backup).
10941097

1098+
`GIT_ALLOW_PROTOCOL`::
1099+
If set, provide a colon-separated list of protocols which are
1100+
allowed to be used with fetch/push/clone. This is useful to
1101+
restrict recursive submodule initialization from an untrusted
1102+
repository. Any protocol not mentioned will be disallowed (i.e.,
1103+
this is a whitelist, not a blacklist). If the variable is not
1104+
set at all, all protocols are enabled. The protocol names
1105+
currently used by git are:
1106+
1107+
- `file`: any local file-based path (including `file://` URLs,
1108+
or local paths)
1109+
1110+
- `git`: the anonymous git protocol over a direct TCP
1111+
connection (or proxy, if configured)
1112+
1113+
- `ssh`: git over ssh (including `host:path` syntax,
1114+
`git+ssh://`, etc).
1115+
1116+
- `rsync`: git over rsync
1117+
1118+
- `http`: git over http, both "smart http" and "dumb http".
1119+
Note that this does _not_ include `https`; if you want both,
1120+
you should specify both as `http:https`.
1121+
1122+
- any external helpers are named by their protocol (e.g., use
1123+
`hg` to allow the `git-remote-hg` helper)
1124+
10951125

10961126
Discussion[[Discussion]]
10971127
------------------------

builtin/blame.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,10 @@ static void pass_blame_to_parent(struct scoreboard *sb,
974974
fill_origin_blob(&sb->revs->diffopt, target, &file_o);
975975
num_get_patch++;
976976

977-
diff_hunks(&file_p, &file_o, 0, blame_chunk_cb, &d);
977+
if (diff_hunks(&file_p, &file_o, 0, blame_chunk_cb, &d))
978+
die("unable to generate diff (%s -> %s)",
979+
sha1_to_hex(parent->commit->object.sha1),
980+
sha1_to_hex(target->commit->object.sha1));
978981
/* The rest are the same as the parent */
979982
blame_chunk(&d.dstq, &d.srcq, INT_MAX, d.offset, INT_MAX, parent);
980983
*d.dstq = NULL;
@@ -1120,7 +1123,9 @@ static void find_copy_in_blob(struct scoreboard *sb,
11201123
* file_p partially may match that image.
11211124
*/
11221125
memset(split, 0, sizeof(struct blame_entry [3]));
1123-
diff_hunks(file_p, &file_o, 1, handle_split_cb, &d);
1126+
if (diff_hunks(file_p, &file_o, 1, handle_split_cb, &d))
1127+
die("unable to generate diff (%s)",
1128+
sha1_to_hex(parent->commit->object.sha1));
11241129
/* remainder, if any, all match the preimage */
11251130
handle_split(sb, ent, d.tlno, d.plno, ent->num_lines, parent, split);
11261131
}

builtin/merge-file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
7575
names[i] = argv[i];
7676
if (read_mmfile(mmfs + i, fname))
7777
return -1;
78-
if (buffer_is_binary(mmfs[i].ptr, mmfs[i].size))
78+
if (mmfs[i].size > MAX_XDIFF_SIZE ||
79+
buffer_is_binary(mmfs[i].ptr, mmfs[i].size))
7980
return error("Cannot merge binary files: %s",
8081
argv[i]);
8182
}

builtin/merge-tree.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ static void show_diff(struct merge_list *entry)
118118
if (!dst.ptr)
119119
size = 0;
120120
dst.size = size;
121-
xdi_diff(&src, &dst, &xpp, &xecfg, &ecb);
121+
if (xdi_diff(&src, &dst, &xpp, &xecfg, &ecb))
122+
die("unable to generate diff");
122123
free(src.ptr);
123124
free(dst.ptr);
124125
}

builtin/rerere.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ static int diff_two(const char *file1, const char *label1,
2929
xdemitconf_t xecfg;
3030
xdemitcb_t ecb;
3131
mmfile_t minus, plus;
32+
int ret;
3233

3334
if (read_mmfile(&minus, file1) || read_mmfile(&plus, file2))
34-
return 1;
35+
return -1;
3536

3637
printf("--- a/%s\n+++ b/%s\n", label1, label2);
3738
fflush(stdout);
@@ -40,11 +41,11 @@ static int diff_two(const char *file1, const char *label1,
4041
memset(&xecfg, 0, sizeof(xecfg));
4142
xecfg.ctxlen = 3;
4243
ecb.outf = outf;
43-
xdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);
44+
ret = xdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);
4445

4546
free(minus.ptr);
4647
free(plus.ptr);
47-
return 0;
48+
return ret;
4849
}
4950

5051
int cmd_rerere(int argc, const char **argv, const char *prefix)
@@ -104,7 +105,8 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
104105
for (i = 0; i < merge_rr.nr; i++) {
105106
const char *path = merge_rr.items[i].string;
106107
const char *name = (const char *)merge_rr.items[i].util;
107-
diff_two(rerere_path(name, "preimage"), path, path, path);
108+
if (diff_two(rerere_path(name, "preimage"), path, path, path))
109+
die("unable to generate diff for %s", name);
108110
}
109111
} else
110112
usage_with_options(rerere_usage, options);

combine-diff.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,10 @@ static void combine_diff(const struct object_id *parent, unsigned int mode,
419419
state.num_parent = num_parent;
420420
state.n = n;
421421

422-
xdi_diff_outf(&parent_file, result_file, consume_line, &state,
423-
&xpp, &xecfg);
422+
if (xdi_diff_outf(&parent_file, result_file, consume_line, &state,
423+
&xpp, &xecfg))
424+
die("unable to generate combined diff for %s",
425+
oid_to_hex(parent));
424426
free(parent_file.ptr);
425427

426428
/* Assign line numbers for this parent.

connect.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "url.h"
1010
#include "string-list.h"
1111
#include "sha1-array.h"
12+
#include "transport.h"
1213

1314
static char *server_capabilities;
1415
static const char *parse_feature_value(const char *, const char *, int *);
@@ -694,6 +695,8 @@ struct child_process *git_connect(int fd[2], const char *url,
694695
else
695696
target_host = xstrdup(hostandport);
696697

698+
transport_check_allowed("git");
699+
697700
/* These underlying connection commands die() if they
698701
* cannot connect.
699702
*/
@@ -727,6 +730,7 @@ struct child_process *git_connect(int fd[2], const char *url,
727730
int putty, tortoiseplink = 0;
728731
char *ssh_host = hostandport;
729732
const char *port = NULL;
733+
transport_check_allowed("ssh");
730734
get_host_and_port(&ssh_host, &port);
731735

732736
if (!port)
@@ -781,6 +785,7 @@ struct child_process *git_connect(int fd[2], const char *url,
781785
/* remove repo-local variables from the environment */
782786
conn->env = local_repo_env;
783787
conn->use_shell = 1;
788+
transport_check_allowed("file");
784789
}
785790
argv_array_push(&conn->args, cmd.buf);
786791

0 commit comments

Comments
 (0)