Skip to content

ci: fix windows-build with GCC v12.x #3864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compat/nedmalloc/nedmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ static NOINLINE void RemoveCacheEntries(nedpool *p, threadcache *tc, unsigned in
}
static void DestroyCaches(nedpool *p) THROWSPEC
{
if(p->caches)
{
threadcache *tc;
int n;
Expand Down
2 changes: 2 additions & 0 deletions compat/win32/syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ void syslog(int priority, const char *fmt, ...)
va_end(ap);

while ((pos = strstr(str, "%1")) != NULL) {
size_t offset = pos - str;
char *oldstr = str;
str = realloc(str, st_add(++str_len, 1));
if (!str) {
free(oldstr);
warning_errno("realloc failed");
return;
}
pos = str + offset;
memmove(pos + 2, pos + 1, strlen(pos));
pos[1] = ' ';
}
Expand Down
9 changes: 9 additions & 0 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -3081,6 +3081,15 @@ char *git_url_basename(const char *repo, int is_bundle, int is_bare)
end--;
}

/*
* It should not be possible to overflow `ptrdiff_t` by passing in an
* insanely long URL, but GCC does not know that and will complain
* without this check.
*/
if (end - start < 0)
die(_("No directory name could be guessed.\n"
"Please specify a directory on the command line"));

/*
* Strip trailing port number if we've got only a
* hostname (that is, there is no dir separator but a
Expand Down
26 changes: 26 additions & 0 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,32 @@ void run_active_slot(struct active_request_slot *slot)
select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout);
}
}

/*
* The value of slot->finished we set before the loop was used
* to set our "finished" variable when our request completed.
*
* 1. The slot may not have been reused for another requst
* yet, in which case it still has &finished.
*
* 2. The slot may already be in-use to serve another request,
* which can further be divided into two cases:
*
* (a) If call run_active_slot() hasn't been called for that
* other request, slot->finished would have been cleared
* by get_active_slot() and has NULL.
*
* (b) If the request did call run_active_slot(), then the
* call would have updated slot->finished at the beginning
* of this function, and with the clearing of the member
* below, we would find that slot->finished is now NULL.
*
* In all cases, slot->finished has no useful information to
* anybody at this point. Some compilers warn us for
* attempting to smuggle a pointer that is about to become
* invalid, i.e. &finished. We clear it here to assure them.
*/
slot->finished = NULL;
}

static void release_active_slot(struct active_request_slot *slot)
Expand Down