bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: "Tim Rühsen" <tim.ruehsen@gmx.de>
Cc: bug-gnulib@gnu.org
Subject: Re: Fix sanitizer error in fchownat.m4
Date: Thu, 21 May 2020 17:22:33 +0200	[thread overview]
Message-ID: <7399257.RPdOTc7G22@omega> (raw)
In-Reply-To: <e97c6577-7167-2b02-8b67-8e1a63701811@gmx.de>

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  <bruno@clisp.org>

	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;



  parent reply	other threads:[~2020-05-21 15:22 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 10:43 Fix memleak in getdelim.m4 Tim Rühsen
2020-05-18 11:50 ` Bruno Haible
2020-05-18 18:21   ` Tim Rühsen
2020-05-18 19:44     ` Bruno Haible
2020-05-19 21:47       ` Tim Rühsen
2020-05-19 22:46         ` Bruno Haible
2020-05-20 18:45           ` Tim Rühsen
2020-05-21 14:22             ` relicense module 'group-member' Bruno Haible
2020-05-21 14:44               ` Eric Blake
2020-05-21 15:10                 ` Jim Meyering
2020-05-21 19:46                   ` Bruno Haible
2020-05-21 19:27               ` Paul Eggert
2020-05-21 14:23             ` Fix memleak in getdelim.m4 Bruno Haible
2020-05-20 21:59       ` Tim Rühsen
2020-05-21 14:26         ` Bruno Haible
2020-05-21 16:11           ` Tim Rühsen
2020-05-21 19:31             ` Bruno Haible
2020-05-22 14:03               ` Tim Rühsen
2020-05-22 15:25                 ` Bruno Haible
2020-05-22 20:46                   ` Tim Rühsen
2020-05-23 17:51                     ` Fix exponentl.m4 test Bruno Haible
2020-05-23 18:48                     ` Fix calloc.m4 test Bruno Haible
2020-05-23 20:26                       ` Paul Eggert
2020-05-23 21:53                         ` Bruno Haible
2020-05-24  0:51                           ` Paul Eggert
2020-05-24  7:53                             ` Bruno Haible
2020-06-06  8:19                       ` Bruno Haible
2020-05-23 19:18                     ` Fix invalid use of __builtin_isnanf and __builtin_isnanl Bruno Haible
2020-05-23 20:18                     ` Fix calloc-gnu configure results Bruno Haible
2020-05-23 20:47                     ` Fix memleak in getdelim.m4 Bruno Haible
2020-05-24  8:39                       ` Tim Rühsen
2020-05-21 15:15         ` SA_RESETHAND Bruno Haible
2020-05-21 20:10           ` SA_RESETHAND Paul Eggert
2020-05-21 20:59             ` SA_RESETHAND Bruno Haible
2020-05-21 15:22         ` Bruno Haible [this message]
2020-05-21 17:42         ` Fix memleak in glob.m4 Bruno Haible
2020-05-21 18:31         ` Fix memleak in regex.m4 Bruno Haible
2020-05-21 18:40         ` Fix memleak in getdelim.m4 Bruno Haible
2020-05-21 19:30           ` Paul Eggert
2020-05-21 19:38             ` Bruno Haible
2020-05-21 14:32 ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7399257.RPdOTc7G22@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=tim.ruehsen@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).