Skip to content

Commit 158a93f

Browse files
authored
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 590ade5 + bc65862 commit 158a93f

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
@@ -3124,6 +3124,15 @@ char *git_url_basename(const char *repo, int is_bundle, int is_bare)
31243124
end--;
31253125
}
31263126

3127+
/*
3128+
* It should not be possible to overflow `ptrdiff_t` by passing in an
3129+
* insanely long URL, but GCC does not know that and will complain
3130+
* without this check.
3131+
*/
3132+
if (end - start < 0)
3133+
die(_("No directory name could be guessed.\n"
3134+
"Please specify a directory on the command line"));
3135+
31273136
/*
31283137
* Strip trailing port number if we've got only a
31293138
* 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
@@ -1403,6 +1403,32 @@ void run_active_slot(struct active_request_slot *slot)
14031403
select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout);
14041404
}
14051405
}
1406+
1407+
/*
1408+
* The value of slot->finished we set before the loop was used
1409+
* to set our "finished" variable when our request completed.
1410+
*
1411+
* 1. The slot may not have been reused for another requst
1412+
* yet, in which case it still has &finished.
1413+
*
1414+
* 2. The slot may already be in-use to serve another request,
1415+
* which can further be divided into two cases:
1416+
*
1417+
* (a) If call run_active_slot() hasn't been called for that
1418+
* other request, slot->finished would have been cleared
1419+
* by get_active_slot() and has NULL.
1420+
*
1421+
* (b) If the request did call run_active_slot(), then the
1422+
* call would have updated slot->finished at the beginning
1423+
* of this function, and with the clearing of the member
1424+
* below, we would find that slot->finished is now NULL.
1425+
*
1426+
* In all cases, slot->finished has no useful information to
1427+
* anybody at this point. Some compilers warn us for
1428+
* attempting to smuggle a pointer that is about to become
1429+
* invalid, i.e. &finished. We clear it here to assure them.
1430+
*/
1431+
slot->finished = NULL;
14061432
}
14071433

14081434
static void release_active_slot(struct active_request_slot *slot)

0 commit comments

Comments
 (0)