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=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29591 invoked from network); 12 Jul 2021 12:53:30 -0000 Received: from tb-ob21.topicbox.com (173.228.157.67) by inbox.vuxu.org with ESMTPUTF8; 12 Jul 2021 12:53:30 -0000 Received: from tb-mx0.topicbox.com (tb-mx0.nyi.icgroup.com [10.90.30.73]) by tb-ob21.topicbox.com (Postfix) with ESMTP id 5DD651B2B2 for ; Mon, 12 Jul 2021 08:53:27 -0400 (EDT) (envelope-from bounce.mMd2aafc19d425830aec9c5ea9.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id 210802B7EF16; Mon, 12 Jul 2021 08:53:27 -0400 (EDT) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,d=none,d.eval=none) policy.policy-from=p header.from=eigenstate.org; spf=pass smtp.mailfrom=ori@eigenstate.org smtp.helo=mimir.eigenstate.org; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=message-id:to:subject:date:from:in-reply-to :mime-version:content-type:content-transfer-encoding:list-help :list-id:list-post:list-subscribe:reply-to:list-unsubscribe; s= sysmsg-1; t=1626094407; bh=IHototeeqvoqYrxqVH9tpt6aJjfokLvZpL3Ap rLMAbU=; b=jEK+RS82TojHuLvLpsKjwZuykzb1FskhgI7t1CuqKTMb14cF/vV+7 SruvCpypt/ZJLCirHkq7ePrVpkRSt/Zhls+RdtsCVfEh9DpENN+cCOGSsZLxTl02 f+OnuOBHZq5fDfpTW34bkPc00dcseUeVMt+odgJvlv6E7E3kEY6xV4= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1626094407; b=KN/+SJbipzilod4WZ8vMOkneeP3rA7E3UGKqj36Nca0P7zTKJ+ W37h0jlrnr5OQmKPwRzP0KHicjrGOsGRW5Rq7wKb03Y4wf+Ec4sVejpl6TJhDb15 cAXXtEfIxShvlc7mkRENmpae7HXU+5EK2SYMXw8JziViqsO3gMFPQPSHI= Authentication-Results: topicbox.com; arc=pass; dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,d=none,d.eval=none) policy.policy-from=p header.from=eigenstate.org; spf=pass smtp.mailfrom=ori@eigenstate.org smtp.helo=mimir.eigenstate.org; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx0.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,d=none,d.eval=none) policy.policy-from=p header.from=eigenstate.org; iprev=pass smtp.remote-ip=206.124.132.107 (mimir.eigenstate.org); spf=pass smtp.mailfrom=ori@eigenstate.org smtp.helo=mimir.eigenstate.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mimir.eigenstate.org policy.ptr=mimir.eigenstate.org; x-return-mx=pass header.domain=eigenstate.org policy.is_org=yes (MX Records found: kusuri.pikopiko.org,mail.pikopiko.org,nokogiri.pikopiko.org,eigenstate.org); x-return-mx=pass smtp.domain=eigenstate.org policy.is_org=yes (MX Records found: kusuri.pikopiko.org,mail.pikopiko.org,nokogiri.pikopiko.org,eigenstate.org); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h=message-id :to:subject:date:from:in-reply-to:mime-version:content-type :content-transfer-encoding:list-help:list-id:list-post :list-subscribe:reply-to:list-unsubscribe; s=dkim-1; bh=fRTIDBLX MjS9AkDH3VzN8ax3v0VYl1sIhdDKtRauPWM=; b=N9jieTfOZOiqnf/Uwxoaxevg DHF4vz1snZwcScBsg1ha2eoo4hMNVpWGCM2XgRB+XJePsyoucIl0KwQkClAGQbaX pcgv8e+Vr/3Bu0t2vQR5cXg7HLJiY5MTthQRsJdRrTUdups8ki/wTFtcFFNWPH5H z0Mm8FCcN+p3QwoI6K0= Received: from tb-mx0.topicbox.com (localhost.local [127.0.0.1]) by tb-mx0.topicbox.com (Postfix) with ESMTP id B21062B7E769 for <9fans@9fans.net>; Mon, 12 Jul 2021 08:53:16 -0400 (EDT) (envelope-from ori@eigenstate.org) Received: from tb-mx0.topicbox.com (localhost [127.0.0.1]) by tb-mx0.topicbox.com (Authentication Milter) with ESMTP id 3A40D99E39A; Mon, 12 Jul 2021 08:53:16 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1626094396; b=DI4EqANBUoww65KTPGwokMRV/JG+ugkHWcbk7X7gbJnkghnJln 57SC1p6RUIFQIJKfZuy5cA9RolHV8vEH5EJTjaMLgw8N+ImE4e4D55kJfjHt2lh4 U0DKyUKTI1U/cC5bZbI2ORBhRc3aDm/ILc0V2j3g1WIzwpP1fislM+Zg919AIdG2 uOICtN1FGGVijUKyN8Inv+U8TkDj6uDBA+8sXt98O7Jq2rsMVLNHTEKEjrzAsIdj su8vsFPSII4Sdtd6T2QpeyzyS3da7iYoy+QzK/N6Yvgk3LglfcLAISZ1UAV0QLwG 6E37x9gXInMSbCzHN1CJjBCs7w3DQT0W6OZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=message-id:to:subject:date:from:in-reply-to :mime-version:content-type:content-transfer-encoding; s=arcseal; t=1626094396; bh=86YYCQjXQFQ6QHVs7P91alxZ2XOOXvARTUWUt6Z8bPs=; b= DqnY4/12iAUxJyxj9N4BdnCtRLYtee3FHBfW/lAgg6uBPdPeqd3LaBMZh8at2Dqw 7KKDvO8bUjwisefJnsngYJpE9Zpas3zzJtH1a4Ul55nCuG3nt+Q+6zxsR5pif1dc VIm/XI1rfg2I58SFfWC0mTcbBcMsXCJcavW94RkWqLILEM5D5YqqU4VrUh85R8xQ PHD1nWuzG+XERLwsQAcbtU+3TL0muXvY2iyVKh9uQdP2Gw/7BanPV2uB7CmGFSKB TdZLqGYLxQx736MvSpOvssbXdDnQG51Uk1kOZV7tWpiBvX+AQe0X00lzW2grzapP zFNC6vJlc/wLrACEwfbcjA== ARC-Authentication-Results: i=1; tb-mx0.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=none policy.applied-disposition=none policy.evaluated-disposition=none (p=none,d=none,d.eval=none) policy.policy-from=p header.from=eigenstate.org; iprev=pass smtp.remote-ip=206.124.132.107 (mimir.eigenstate.org); spf=pass smtp.mailfrom=ori@eigenstate.org smtp.helo=mimir.eigenstate.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mimir.eigenstate.org policy.ptr=mimir.eigenstate.org; x-return-mx=pass header.domain=eigenstate.org policy.is_org=yes (MX Records found: kusuri.pikopiko.org,mail.pikopiko.org,nokogiri.pikopiko.org,eigenstate.org); x-return-mx=pass smtp.domain=eigenstate.org policy.is_org=yes (MX Records found: kusuri.pikopiko.org,mail.pikopiko.org,nokogiri.pikopiko.org,eigenstate.org); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvgdefheculddtuddrgeduledrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghn shhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtne cunecujfgurhepkffvufffhfgjgggtgfesthejjedttddtvdenucfhrhhomhepohhrihes vghighgvnhhsthgrthgvrdhorhhgnecuggftrfgrthhtvghrnhepvdehtdeffeetgeelhf egkeehhfeuhfehvddvieduueehjeetgeevkeeitdevuefhnecukfhppedvtdeirdduvdeg rddufedvrddutdejpdejgedruddtkedrheeirddvvdehnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehinhgvthepvddtiedruddvgedrudefvddruddtjedphhgvlhho pehmihhmihhrrdgvihhgvghnshhtrghtvgdrohhrghdpmhgrihhlfhhrohhmpeeoohhrih esvghighgvnhhsthgrthgvrdhorhhgqe X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (eigenstate.org: 206.124.132.107 is authorized to use 'ori@eigenstate.org' in 'mfrom' identity (mechanism 'mx' matched)) receiver=tb-mx0.topicbox.com; identity=mailfrom; envelope-from="ori@eigenstate.org"; helo=mimir.eigenstate.org; client-ip=206.124.132.107 Received: from mimir.eigenstate.org (mimir.eigenstate.org [206.124.132.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx0.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Mon, 12 Jul 2021 08:53:15 -0400 (EDT) (envelope-from ori@eigenstate.org) Received: from abbatoir.myfiosgateway.com (pool-74-108-56-225.nycmny.fios.verizon.net [74.108.56.225]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 6213c2a7 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9fans@9fans.net>; Mon, 12 Jul 2021 05:53:13 -0700 (PDT) Message-ID: To: 9fans@9fans.net Subject: Re: [9fans] pngread: alloc chunk's length Date: Mon, 12 Jul 2021 08:53:12 -0400 From: ori@eigenstate.org In-Reply-To: <20210710214954.2edyc4spnlfxaq2z@sdf.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 2329e65a-e310-11eb-9c1a-d698e9def9fa Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UNGE3MTRlZDE0YzUwNzY3YS1NZDJhYWZjMTlkNDI1ODMwYWVjOWM1?= =?UTF-8?B?ZWE5Pg==?= List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:Md2aafc19d425830aec9c5ea9:1:uIbRc8UvzkJebHe3aa5BvRrg7Z3dEx8W1ZbqAhl0Tho Quoth adr via 9fans <9fans@9fans.net>: > Checking the sent mail I noticed that I forgot to remove mag... Why not make getchunk allocate? Somethign like: --- //.git/fs/object/e8259861da3a55c03491904e4d11c5c15b7577c5/tree/sys/src/= cmd/jpg/readpng.c +++ sys/src/cmd/jpg/readpng.c @@ -94,7 +94,7 @@ } =20 static int -getchunk(Biobuf *b, char *type, uchar *d, int m) +getchunk(Biobuf *b, char *type, uchar **d) { uchar buf[8]; ulong crc =3D 0, crc2; @@ -103,11 +103,10 @@ if(Bread(b, buf, 8) !=3D 8) return -1; n =3D get4(buf); + *d =3D pngmalloc(n, 0); memmove(type, buf+4, 4); type[4] =3D 0; - if(n > m) - sysfatal("getchunk needed %d, had %d", n, m); - nr =3D Bread(b, d, n); + nr =3D Bread(b, *d, n); if(nr !=3D n) sysfatal("getchunk read %d, expected %d", nr, n); crc =3D blockcrc(crctab, crc, type, 4); @@ -131,7 +130,7 @@ Again: z->p =3D z->buf; z->e =3D z->p; - n =3D getchunk(z->io, type, z->p, IDATSIZE); + n =3D getchunk(z->io, type, &z->p); if(n < 0 || strcmp(type, "IEND") =3D=3D 0) return -1; z->e =3D z->p + n; ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T4a714ed14c50767a-Md2aaf= c19d425830aec9c5ea9 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription