From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8463 invoked from network); 12 Sep 2022 07:37:10 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Sep 2022 07:37:10 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1662968230; b=nDD7l8h6OM+UPx9akKtW3AUCzM1ksEQrSBm6WZV5fbYaS7exnmL7ZBfGY3NohWrf+sFI3xVo6N goJ2Fzw/RSmWjehkW0BSaUawaN+p6+seZvhd/p3s2N7QECW5++rD/puojia9ksUeuxVKQBj+aQ 9Mq5hUaLVhn952uQ1X6VXTT1SPm/mEPRlE0POIRbaK7s3Kt5PlQDK7jHuGmRksjArLPIBMYb1P KDFk0lR896v9wpe/mobxX21LzsE5JIzzcH//PHRz7fPCwKeVopM989RuPvcJyMUM7a2KTLcEIR K2rYtL+Yq0UqiShdU2P/nmrjmTH1pqaQMpBubvAwYVS9IA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd00007-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.7; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1662968230; bh=CPKzhvBjFp8FfXeaP55k2Hasgi1z4qZI1gyrKEOB0Dk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=ltkdYYNKGT7/2Vlb6TXEoWijREZntzc2/u8es3KPQu4+AKAvAipL0KnWCsc43oKsA4pLIHfSkG LrnNbtCA68gOe13LDm1tOL5AK+P49AGxbHdDy6B1JXBNn7rTnoFPXxIEyvKsAVSHBRbbiwsQrX LNr2bk1T4Us2RUz53ssjPw1NhtlFMEaAN6g42cab4ES4/Eax3H+sD4VuDq4cdqRP1Eo36bZ1tN Guh57iAgdRM4RAf3+80gwJljlHoviIEorMJcz82/MfzLzQERJpCPEsPp9/M9Gq4wHGdSC4pRAK vvk2iDb4Ev1Bq072aF4c1N97fSP25JsGo7w0TRtH1I5NGA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=8IKAtDGjtnilqROHGWGhrR1t7JcO2JwUq5hQ3Hek/oA=; b=EV28AtRgeHqbWjl2aHQ2N0WGef 19Q/4VoyuibC7WtzjCqHO6Tdmleaksxm48XeJMrzUNmiHVY/J5rI+cdolcRJmaHLEc0jJtLxILkTZ h+u98JkgCQ+wB1o5eBYHZdC4sAEQtxLE+I78tEJkb/Qq7YkYg+dBp4PuFF7xnfnJ1q8s3M/NiOKMP akHvdyTUNwUFE8keWAMzu7FbNhjXajPKIP21fFcjUj4OM12OIh4f5ChCDVojKKiNO37e1IznVkwIV 3v9B0Gqh9EF5QTbDdZ8kSqSply2SU4YKXJBr7hXLer3r0UkW8azX8/y3nJcmc+MGoUKkZd6lwLbd8 kz3Tq2XA==; Received: from authenticated user by zero.zsh.org with local id 1oXe0D-000PIU-VD; Mon, 12 Sep 2022 07:37:09 +0000 Authentication-Results: zsh.org; iprev=pass (snd00007-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.7; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd00007-bg.im.kddi.ne.jp ([27.86.113.7]:1633 helo=dfmta0015.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oXdzN-000OSN-KD; Mon, 12 Sep 2022 07:36:18 +0000 Received: from mail.biglobe.ne.jp by omta0015.biglobe.ne.jp with ESMTP id <20220912073613969.YBUB.122659.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Mon, 12 Sep 2022 16:36:13 +0900 From: Jun T Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: ZSH crashed when reading bytes from a large binary Date: Mon, 12 Sep 2022 16:36:13 +0900 References: To: zsh-workers@zsh.org In-Reply-To: Message-Id: <8F410818-257D-470A-B620-2F776E960ABC@kba.biglobe.ne.jp> X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 50624 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: > 2022/09/11 23:43, Liu, Song wrote: > =20 > The problem is that, when ZSH failed to reallocate memory, ZSH = didn=E2=80=99t check the return value of `realloc` function and handle = the error. This will make ZSH crash.=20 > =20 > On line 6923 of `zsh/Src/builtin.c`, the correct code should like the = following: > =20 > ``` c > If (buf =3D realloc(buf, bsiz *=3D 2)) { > // same as previous code > } else { > free(buf); > return EXIT_FAILURE; > } There are many other places where the return value of realloc() is not = checked. Can we simply replace them by zrealloc()?=