From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id B7E653857402 for ; Thu, 15 Sep 2022 02:56:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B7E653857402 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1663210599; bh=UZuuzaym3EQEOB0/WUohVXjVXl3cE+sWEjzpDUyRka0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ViC79804siKCvIEpkO2EVQEPRdDxekLsTseRFZ/iMVXdxpoG4/Pa+uGn5IfFIvnRZ lrFsluac/6gC/Iuj/QUukDGlF49r9MtpnFrl7nBGSIcJaUWpuFIpaAK2ZbvmooUB5I 46bAOUPBL6610dQoWF2r4D+8VJuuq+QC19OLbolA= Received: from [IPv6:240e:358:11e5:2b00:dc73:854d:832e:3] (unknown [IPv6:240e:358:11e5:2b00:dc73:854d:832e:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id C6BB365DC6; Wed, 14 Sep 2022 22:56:35 -0400 (EDT) Message-ID: <527fb03481edd9f58a938ecaf1583051cce06ac0.camel@xry111.site> Subject: Re: [PATCH 1/2] LoongArch: Avoid heap-buffer-overflow in loongarch_elf_relocate_section From: Xi Ruoyao To: liuzhensong , binutils@sourceware.org Cc: Chenghua Xu , Lulu Cheng , Wang Xuerui Date: Thu, 15 Sep 2022 10:56:28 +0800 In-Reply-To: <6f3d0d05-c7a2-b4cf-2a3c-abb1f343ff86@loongson.cn> References: <20220913154414.554861-1-xry111@xry111.site> <20220913154414.554861-2-xry111@xry111.site> <7f2c274b80fa79296005edaf52036745510a83fd.camel@xry111.site> <6f3d0d05-c7a2-b4cf-2a3c-abb1f343ff86@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 User-Agent: Evolution 3.45.3 MIME-Version: 1.0 X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD,GIT_PATCH_0,LIKELY_SPAM_FROM,PDS_OTHER_BAD_TLD,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: T24gVGh1LCAyMDIyLTA5LTE1IGF0IDA5OjQ3ICswODAwLCBsaXV6aGVuc29uZyB3cm90ZToKPiA+ IEhvdyBhYm91dCB0aGlzP8KgIFdlIGRvbid0IG5lZWQgdG8gd3JpdGUgaW50byB0aGUgR09UIGlm Cj4gPiBSX0xBUkNIX1JFTEFUSVZFCj4gPiBvciBSX0xBUkNIX0lSRUxBVElWRSB3aWxsIGJlIHVz ZWQ6Cj4gwqA+ICJXZSBkb24ndCBuZWVkIHRvIHdyaXRlIGludG8gdGhlIEdPVCBpZiBSX0xBUkNI X1JFTEFUSVZFIG9yIAo+IFJfTEFSQ0hfSVJFTEFUSVZFIHdpbGwgYmUgdXNlZDoiCj4gCj4gTm90 IG9ubHkgdGhpcywgeW91IGNhbiByZWZlciB0byB0aGUgaW1wbGVtZW50YXRpb24gb2YgdGhlIGZ1 bmN0aW9uIAo+IF9iZmRfZWxmX2FsbG9jYXRlX2lmdW5jX2R5bl9yZWxvY3MgZm9yIGRldGFpbHMu CgpJIGRvbid0IHRoaW5rIF9iZmRfZWxmX2FsbG9jYXRlX2lmdW5jX2R5bl9yZWxvY3MgKG9yCmxv Y2FsX2Fsb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