Merge branch 'js/ci-gcc-12-fixes'

Fixes real problems noticed by gcc 12 and works around false
positives.

* js/ci-gcc-12-fixes:
  dir.c: avoid "exceeds maximum object size" error with GCC v12.x
  nedmalloc: avoid new compile error
  compat/win32/syslog: fix use-after-realloc
This commit is contained in:
Junio C Hamano
2022-05-31 19:10:35 -07:00
3 changed files with 11 additions and 1 deletions

9
dir.c
View File

@ -3137,6 +3137,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