From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1376F1F4B5 for ; Tue, 12 Nov 2019 10:42:05 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=tZTc9y71E3QU6b3n7RlC6utjIwNof0kXzfCYigHzSgR CnmNKD6t3MkZs7jV/XPifN4yQcUIvEH3XyEUZkZPmlhbnZ7g4K6HZFfNu3mSAWzl uDermI/eQYJ9lXevReiUK8AlhFhgJjACBmHczG9pbH5FiwM/FJX/24u2G2TOXRGY = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; s=default; bh=+ZG9AtehUkyR6YdkOeiUacSJkFE=; b=GjvsFTuLuvmsV3n6u Pmz7+E0EvmG5i/YM0Q1s1A3y6wA3Y5aguhtLAHJrSZDKbpKZivFX3CeyyXdZTu5C V+mU3L4RhGMXbsjV0IueBEJ6yoxPZQuVisUX8qFyQ4q3Fxhgn33ibXPe8Et6Et9z 7dtpmpcwYAWF/MH1WuBX0Q4dKk= Received: (qmail 29018 invoked by alias); 12 Nov 2019 10:42:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 29007 invoked by uid 89); 12 Nov 2019 10:42:02 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573555320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HO3szIhimYHLuyuW9188XGCaD4lvEnJFg0NWPdpyz9k=; b=Eivj+ylH4s6Z+YoogbXf6kEbmqiQhXazkJc8O20ujY7k4AmFv3RkD9dllRhiqFqfqTLh8O +1Uxi8cQI73W+EuHp2BXhjVVJ2my7Exm1HqaATqvhN3IrqDO07LGdsg49iPJHu8WwGVF0Z RGgXriWbS/C3zX3ZIH6Aluykw58Qc4E= From: Florian Weimer To: liqingqing Cc: Liusirui , , , , , Subject: Re: [PATCH] fix null pointer in mtrace References: <1573550539-34259-1-git-send-email-liusirui@huawei.com> Date: Tue, 12 Nov 2019 11:41:51 +0100 In-Reply-To: (liqingqing's message of "Tue, 12 Nov 2019 17:39:59 +0800") Message-ID: <87a791qsuo.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable * 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