Skip to content

Commit 54b5c49

Browse files
committed
Merge branch 'js/ci-gcc-12-fixes'
This branch brings a couple of fixes to be able to compile Git in `DEVELOPER=1` mode again. The only remaining issue is a local variable's address in `run_active_slot()` in `http.c` that is assigned to a struct that is still valid after the function scope was left. Junio wanted to do this differently from my proposed solution, and we'll merge Junio's work-around next. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents e54793a + 2acf4cf commit 54b5c49

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

compat/nedmalloc/nedmalloc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ static NOINLINE void RemoveCacheEntries(nedpool *p, threadcache *tc, unsigned in
323323
}
324324
static void DestroyCaches(nedpool *p) THROWSPEC
325325
{
326-
if(p->caches)
327326
{
328327
threadcache *tc;
329328
int n;

compat/win32/syslog.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ void syslog(int priority, const char *fmt, ...)
4343
va_end(ap);
4444

4545
while ((pos = strstr(str, "%1")) != NULL) {
46+
size_t offset = pos - str;
4647
char *oldstr = str;
4748
str = realloc(str, st_add(++str_len, 1));
4849
if (!str) {
4950
free(oldstr);
5051
warning_errno("realloc failed");
5152
return;
5253
}
54+
pos = str + offset;
5355
memmove(pos + 2, pos + 1, strlen(pos));
5456
pos[1] = ' ';
5557
}

dir.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3081,6 +3081,15 @@ char *git_url_basename(const char *repo, int is_bundle, int is_bare)
30813081
end--;
30823082
}
30833083

3084+
/*
3085+
* It should not be possible to overflow `ptrdiff_t` by passing in an
3086+
* insanely long URL, but GCC does not know that and will complain
3087+
* without this check.
3088+
*/
3089+
if (end - start < 0)
3090+
die(_("No directory name could be guessed.\n"
3091+
"Please specify a directory on the command line"));
3092+
30843093
/*
30853094
* Strip trailing port number if we've got only a
30863095
* hostname (that is, there is no dir separator but a

0 commit comments

Comments
 (0)