[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix sanitizer error in fchownat.m4
From: |
Bruno Haible |
Subject: |
Re: Fix sanitizer error in fchownat.m4 |
Date: |
Thu, 21 May 2020 17:22:33 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; ) |
Tim Rühsen wrote:
> configure:55268: checking whether fchownat works with AT_SYMLINK_NOFOLLOW
> SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change
> conftest.c:812:50 in
> configure:55326: checking whether fchownat works with an empty file name
> SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change
> conftest.c:817:37 in
This patch should fix it.
2020-05-21 Bruno Haible <address@hidden>
fchownat: Support clang -fsanitize=implicit-integer-sign-change better.
Reported by Tim Rühsen in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00207.html>.
* m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG,
gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Cast -1 to uid_t or git_t,
respectively.
diff --git a/m4/fchownat.m4 b/m4/fchownat.m4
index cd5c301..0a5d637 100644
--- a/m4/fchownat.m4
+++ b/m4/fchownat.m4
@@ -1,4 +1,4 @@
-# fchownat.m4 serial 5
+# fchownat.m4 serial 6
dnl Copyright (C) 2004-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -64,7 +64,7 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG],
int
main ()
{
- return (fchownat (AT_FDCWD, "$gl_dangle", -1, getgid (),
+ return (fchownat (AT_FDCWD, "$gl_dangle", (uid_t)(-1), getgid (),
AT_SYMLINK_NOFOLLOW) != 0
&& errno == ENOENT);
}
@@ -98,7 +98,7 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG],
fd = open ("conftestdir", O_RDONLY);
if (fd < 0)
return 3;
- ret = fchownat (fd, "", -1, -1, 0);
+ ret = fchownat (fd, "", (uid_t)(-1), (gid_t)(-1), 0);
close (fd);
rmdir ("conftestdir");
return ret == 0;
- Re: Fix calloc.m4 test, (continued)
- Fix invalid use of __builtin_isnanf and __builtin_isnanl, Bruno Haible, 2020/05/23
- Fix calloc-gnu configure results, Bruno Haible, 2020/05/23
- Re: Fix memleak in getdelim.m4, Bruno Haible, 2020/05/23
- Re: Fix memleak in getdelim.m4, Tim Rühsen, 2020/05/24
- SA_RESETHAND, Bruno Haible, 2020/05/21
- Re: SA_RESETHAND, Paul Eggert, 2020/05/21
- Re: SA_RESETHAND, Bruno Haible, 2020/05/21
- Re: Fix sanitizer error in fchownat.m4,
Bruno Haible <=
- Fix memleak in glob.m4, Bruno Haible, 2020/05/21
- Fix memleak in regex.m4, Bruno Haible, 2020/05/21
- Re: Fix memleak in getdelim.m4, Bruno Haible, 2020/05/21
- Re: Fix memleak in getdelim.m4, Paul Eggert, 2020/05/21
- Re: Fix memleak in getdelim.m4, Bruno Haible, 2020/05/21
Re: Fix memleak in getdelim.m4, Bruno Haible, 2020/05/21