Skip to content

Commit 8b930d1

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge pull request #3864 from dscho/fix-win-build-with-gcc-12-on-top-of-v2.36.1
ci: fix `windows-build` with GCC v12.x
2 parents 463a4a0 + bc65862 commit 8b930d1

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-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
@@ -3180,6 +3180,15 @@ char *git_url_basename(const char *repo, int is_bundle, int is_bare)
31803180
end--;
31813181
}
31823182

3183+
/*
3184+
* It should not be possible to overflow `ptrdiff_t` by passing in an
3185+
* insanely long URL, but GCC does not know that and will complain
3186+
* without this check.
3187+
*/
3188+
if (end - start < 0)
3189+
die(_("No directory name could be guessed.\n"
3190+
"Please specify a directory on the command line"));
3191+
31833192
/*
31843193
* Strip trailing port number if we've got only a
31853194
* hostname (that is, there is no dir separator but a

http.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,32 @@ void run_active_slot(struct active_request_slot *slot)
14211421
select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout);
14221422
}
14231423
}
1424+
1425+
/*
1426+
* The value of slot->finished we set before the loop was used
1427+
* to set our "finished" variable when our request completed.
1428+
*
1429+
* 1. The slot may not have been reused for another requst
1430+
* yet, in which case it still has &finished.
1431+
*
1432+
* 2. The slot may already be in-use to serve another request,
1433+
* which can further be divided into two cases:
1434+
*
1435+
* (a) If call run_active_slot() hasn't been called for that
1436+
* other request, slot->finished would have been cleared
1437+
* by get_active_slot() and has NULL.
1438+
*
1439+
* (b) If the request did call run_active_slot(), then the
1440+
* call would have updated slot->finished at the beginning
1441+
* of this function, and with the clearing of the member
1442+
* below, we would find that slot->finished is now NULL.
1443+
*
1444+
* In all cases, slot->finished has no useful information to
1445+
* anybody at this point. Some compilers warn us for
1446+
* attempting to smuggle a pointer that is about to become
1447+
* invalid, i.e. &finished. We clear it here to assure them.
1448+
*/
1449+
slot->finished = NULL;
14241450
}
14251451

14261452
static void release_active_slot(struct active_request_slot *slot)

0 commit comments

Comments
 (0)