unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: liqingqing <liqingqing3@huawei.com>
Cc: Liusirui <liusirui@huawei.com>,  <libc-alpha@sourceware.org>,
	 <carlos@redhat.com>,  <siddhesh@gotplt.org>,  <dj@redhat.com>,
	 <hushiyuan@huawei.com>
Subject: Re: [PATCH] fix null pointer in mtrace
Date: Tue, 12 Nov 2019 11:41:51 +0100	[thread overview]
Message-ID: <87a791qsuo.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <fcd6b190-6e21-040b-edea-4c91377be814@huawei.com> (liqingqing's message of "Tue, 12 Nov 2019 17:39:59 +0800")

* liqingqing:

> I had tested this scenario, it seems like that the fprintf and other
> file operation function do not check the invalid argument like the
> null pointer.  does any one knows why fprintf do not check the input?

It's not required by the standard because violating preconditions
results in undefined behavior.  Sloppily written code with such bugs
tends to not check error returns from functions, either.  This means if
we added a null check for the stream argument to fprintf (e.g., failing
with EINVAL in that case), it would only obscure the problem and make
diagnosis even more difficult.

Thanks,
Florian


  reply	other threads:[~2019-11-12 10:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12  9:22 [PATCH] fix null pointer in mtrace Liusirui
2019-11-12  9:39 ` liqingqing
2019-11-12 10:41   ` Florian Weimer [this message]
2019-11-13  1:28     ` liqingqing
  -- strict thread matches above, loose matches on Subject: below --
2019-11-13  9:36 Liusirui
2019-11-13 12:59 ` Carlos O'Donell

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://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=87a791qsuo.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=carlos@redhat.com \
    --cc=dj@redhat.com \
    --cc=hushiyuan@huawei.com \
    --cc=libc-alpha@sourceware.org \
    --cc=liqingqing3@huawei.com \
    --cc=liusirui@huawei.com \
    --cc=siddhesh@gotplt.org \
    /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).