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=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,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 ADF131F4B5 for ; Wed, 13 Nov 2019 01:28:15 +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:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=fUWxsF++jz/fRaAV j+tZUK8M1Wk61RAc6Ry8kHDjHhlbGMBVyJW/aszSWWniMK4BSwL8TLcAPRBld0Ns eQZ5pGCd4fO3tdsqrdBGbr80zejRd1iPwrPOryYTseSgBNgp3NvqCrwqnp5bVvfh SmlzN1iVxyIW1ptoqK9Zf9Wu2SY= 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:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=/H2RswsibbApeVbeAIPMIc 3sGWs=; b=yDCA7AD2lHD6Oxm/oA7jYbdHpF7e3532wy6WYnVY7+JUrsSXr+T7ym MTB+NPu66tyOte/5TjNL0RWKDeL5qbTZC2btPDAV/oiFFjOClQZu5xfmnbohsOsU aGIawOmbcUuAxjec8jv7PWANWgGGP32iI0CQOZiDp43l+McxrjEfs= Received: (qmail 41207 invoked by alias); 13 Nov 2019 01:28:12 -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 41199 invoked by uid 89); 13 Nov 2019 01:28:12 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: huawei.com Subject: Re: [PATCH] fix null pointer in mtrace To: Florian Weimer CC: liusirui , "libc-alpha@sourceware.org" , "carlos@redhat.com" , "siddhesh@gotplt.org" , "dj@redhat.com" , Hushiyuan References: <1573550539-34259-1-git-send-email-liusirui@huawei.com> <87a791qsuo.fsf@oldenburg2.str.redhat.com> From: liqingqing Message-ID: <3d76a566-015d-f8e7-5e00-52e286ba69bf@huawei.com> Date: Wed, 13 Nov 2019 09:28:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <87a791qsuo.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On 2019/11/12 18:41, Florian Weimer wrote: > * 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 > clear, thank you Florian