autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] lib/autoconf/c.m4: fix NULL pointer dereference in _AC_LANG_


From: Zack Weinberg
Subject: Re: [PATCH] lib/autoconf/c.m4: fix NULL pointer dereference in _AC_LANG_IO_PROGRAM
Date: Mon, 28 Jun 2021 13:48:43 -0400

On Mon, Jun 28, 2021 at 10:17 AM Nicolas Iooss <nicolas.iooss@ledger.fr> wrote:
> * lib/autoconf/c.m4: return an error when f is NULL.
> ---
>  lib/autoconf/c.m4 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
> index 9f881f0bc10c..0d9efa62d450 100644
> --- a/lib/autoconf/c.m4
> +++ b/lib/autoconf/c.m4
> @@ -114,7 +114,7 @@ $2
>  m4_define([_AC_LANG_IO_PROGRAM(C)],
>  [AC_LANG_PROGRAM([@%:@include <stdio.h>],
>  [FILE *f = fopen ("conftest.out", "w");
> - return ferror (f) || fclose (f) != 0;
> + return !f || ferror (f) || fclose (f) != 0;
>  ])])

Thank you for the bug report and the patch. The change looks correct
and is simple enough not to require a copyright assignment. I will
apply it to Autoconf trunk in the next few days.

Our test suite does not catch this bug, which probably means it never
tests AC_LANG_IO_PROGRAM inside AC_RUN_IFELSE. Would you be willing to
write a test case, perhaps based on the configure.ac that caused you
to discover the bug? If you don't have time to write a test yourself,
could you at least tell us about how you found the bug?

zw



reply via email to

[Prev in Thread] Current Thread [Next in Thread]