Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx4.public.one.com ([10.246.18.24])
	by mail6.local.one.com (Dovecot) with LMTP id bN99Bu+FiFmRcgAAsyOMew
	for <filtered@awaresystems.be>; Mon, 07 Aug 2017 15:57:18 +0000
X-HalOne-ID: 16080fa9-7b89-11e7-9ac0-b82a72d0454d
Received: from mail-oi0-f41.google.com (unknown [209.85.218.41])
	by mx4.public.one.com (Halon) with ESMTPS
	id 16080fa9-7b89-11e7-9ac0-b82a72d0454d;
	Mon, 07 Aug 2017 15:57:17 +0000 (UTC)
Received: by mail-oi0-f41.google.com with SMTP id e124so8086576oig.2
        for <filtered@awaresystems.be>; Mon, 07 Aug 2017 08:57:17 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-original-authentication-results:x-gm-message-state:delivered-to
         :mime-version:in-reply-to:references:from:date:message-id:to:cc
         :subject:precedence:list-id:list-unsubscribe:list-archive:list-post
         :list-help:list-subscribe:mime-version:sender:errors-to;
        bh=UAF2RJEx9Ily/HjvlJq5s5rjYkY9m7JShNRbN/qaTys=;
        b=dW6VZc6wXXh83f5St+6EPg9ufx+ZwO/2aip+UpLZnuHg+zJJwL3UmGPLmVNx2yDm/U
         kZG8N/FtP3fQNOhwyNd8t2WBSqpRBw3AAU5qS+YcHh5/HixB2FmMMeh0HI0OElfQn8Cq
         1XZuoQ5S/JHnru13EFJHh2nLZ8wfuwa9VgvqxAIAm0E2LsG946VUNraIF1zBhLz8Ck5q
         BDOWfNdn/ifgW4bae+HbYAnL0Orq+dyjocD9Gg083VYR2+250cQkkfM5oBWXQ4M0o1E1
         w3TDpue64mY3NGQ/wQSzlP895PONFUGslaabcZYNiTNtUoIQ15KcRSvXvPrhZJ5Z5pUX
         wGig==
X-Original-Authentication-Results: mx.google.com;       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org;       dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com
X-Gm-Message-State: AHYfb5g7bugHDSsNYNm7d96c/ytXVrLMUeaRSK0r/JYog4rvKR2kI3/R
	YN81gtbi6uc3lKrRweziGZPCf2lKFOs92S2yw1yTDQ==
X-Received: by 10.202.108.130 with SMTP id h124mr746101oic.289.1502121436299;
        Mon, 07 Aug 2017 08:57:16 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.74.68.1 with SMTP id o1csp2852996ooa;
        Mon, 7 Aug 2017 08:57:15 -0700 (PDT)
X-Received: by 10.223.136.176 with SMTP id f45mr793955wrf.289.1502121434926;
        Mon, 07 Aug 2017 08:57:14 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1502121434; cv=none;
        d=google.com; s=arc-20160816;
        b=bd3pUYx9MviB1t6kSBXXIM9+2MNgEqmmObyOMaglp95xLs/6GINpJdZWKEVcKl1tRS
         LJArMCV69KSyumn+nqc79hhqJlWtSQliqCHEXcGLV+aqf9kPAuN1x0By7TzYK1XVA4p8
         0Jozum+RWwGmU2hqjWVkAxYqw8HoBuPd0oo3YEc1UdypkUYSJADjSdQKWthBntE8UB9f
         zuNWby8vA7RPj3GGXl4t3rq3ff7NdMcnLAhD2BXR9Xh7IJUfrhMbbfUD/d+Zew4BKQMO
         8abTv+wmpyrGuEprK4KU+itsPpPIaazO5kNcUOsXSdpLD8ChcTLWBxVwos0e3y2KvWoY
         /jbA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=errors-to:sender:mime-version:list-subscribe:list-help:list-post
         :list-archive:list-unsubscribe:list-id:precedence:subject:cc:to
         :message-id:date:from:references:in-reply-to:mime-version
         :arc-authentication-results;
        bh=UAF2RJEx9Ily/HjvlJq5s5rjYkY9m7JShNRbN/qaTys=;
        b=AJomdN01X3FAhPnb3+6L/VsmQiMWXHsNCdv6hfwV38deUUr0WYXhgdAVSCNFy9kaw5
         TNU4eEoV3py46D9paMlV9m3UgUoSDcmCIz0vXdmMosvHEFLq5ver/e2OSUuem3qvYJhg
         1KTXhQCiJtVKrrVYhRiUiwYDaafyD1KaPMNeupiY7CYTOKJHOp8fS/seugvi96aqswnN
         8PGj+UD7BqWPP+mx/3HY7+7olz8OTxSziMEaXHgsZYP2laiC//pYevuN4KcXtvZSz7PA
         0L4ojlm1M5GCg2ocsU6A7TxMGCZuZQsRGEjU9KAfzui0xPnGtQjpiHtpb1sPeL5jLIr4
         J/Wg==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org;
       dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Return-Path: <tiff-bounces@lists.maptools.org>
Received: from lists.maptools.org (ks365428.kimsufi.com. [94.23.4.142])
        by mx.google.com with ESMTP id p199si7652626wme.198.2017.08.07.08.57.13;
        Mon, 07 Aug 2017 08:57:14 -0700 (PDT)
Received-SPF: neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=94.23.4.142;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org;
       dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id F3C5635C050;
	Mon,  7 Aug 2017 10:56:01 -0500 (EST)
Received: from mail-qk0-f179.google.com (mail-qk0-f179.google.com
	[209.85.220.179])
	by lists.maptools.org (Postfix) with ESMTPS id B9E7635C027
	for <tiff@lists.maptools.org>; Mon,  7 Aug 2017 10:54:02 -0500 (EST)
Received: by mail-qk0-f179.google.com with SMTP id d145so4942648qkc.2
	for <tiff@lists.maptools.org>; Mon, 07 Aug 2017 08:54:02 -0700 (PDT)
X-Received: by 10.55.148.134 with SMTP id w128mr1326427qkd.36.1502121241352;
	Mon, 07 Aug 2017 08:54:01 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.185.153 with HTTP; Mon, 7 Aug 2017 08:53:40 -0700 (PDT)
In-Reply-To: <2618461.QkQZmnuqRY@even-i700>
References: <CABoQFUD-RYPQeJSCBPVdXNeA-yESnHH1QcySUPd3QA=SxMcOOA@mail.gmail.com>
	<alpine.GSO.2.20.1708021019070.287@scrappy.simplesystems.org>
	<CABoQFUCwG6Nb7GNwkU1xp-jdUP2eeEqWdGoYXkHs2t2fJzc2GA@mail.gmail.com>
	<2618461.QkQZmnuqRY@even-i700>
From: Nicolas RUFF <nicolas.ruff@gmail.com>
Date: Mon, 7 Aug 2017 17:53:40 +0200
Message-ID: <CABoQFUA7iVan8dC-iNjm6H=K9AudhXXB3TFOsWdLvqskP0_9KA@mail.gmail.com>
To: Even Rouault <even.rouault@spatialys.com>
Cc: tiff@lists.maptools.org
Subject: Re: [Tiff] Error handling in Read/Write/Seek
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============2066096137=="
Mime-version: 1.0
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

--===============2066096137==
Content-Type: multipart/alternative; boundary="94eb2c0853f8001fff05562bdb83"

--94eb2c0853f8001fff05562bdb83
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thank you all. I filed http://bugzilla.maptools.org/show_bug.cgi?id=3D2726 =
as
a follow-up. Let's continue this discussion on the bug.

Regards,
- Nicolas RUFF

2017-08-04 17:27 GMT+02:00 Even Rouault <even.rouault@spatialys.com>:

> On jeudi 3 ao=C3=BBt 2017 17:04:55 CEST Nicolas RUFF wrote:
>
> > > It seems best to block any negative size values from being passed int=
o
>
> > > these functions in the first place. Libtiff is not in control of the
> I/O
>
> > > functions, so it is best to assure that they are not passed illegal
>
> > > values which might cause I/O implementations to do very bad things.
>
> >
>
> > Not sure to understand what you mean here. Here are all call locations
>
> > for SeekOK():
>
> > tif_dir.c : 2 times
>
> > tif_read.c : 4 times
>
> > tif_write.c : 1 time
>
> > tif_dirread.c : 3 times
>
> > tif_dirwrite.c : 9 times
>
> >
>
> > Do you suggest to add an extra check for (off<0) before each call? If
>
> > yes, I can prepare a patch.
>
>
>
> Before patching *all* those calls, I'd start with just the one (or the fe=
w
> ones) that are needed with your fuzzed file (blindly guessing that the
> issue is localized and not general...)
>
>
>
> Opening a ticket in http://bugzilla.maptools.org/enter_bug.cgi with the
> reproducer file and your proposed patch would be good.
>
>
>
> Even
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>

--94eb2c0853f8001fff05562bdb83
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thank you all. I filed=C2=A0<a href=3D"http://bugzilla.map=
tools.org/show_bug.cgi?id=3D2726">http://bugzilla.maptools.org/show_bug.cgi=
?id=3D2726</a> as a follow-up. Let&#39;s continue this discussion on the bu=
g.<div><br></div><div>Regards,</div><div>- Nicolas RUFF</div></div><div cla=
ss=3D"gmail_extra"><br><div class=3D"gmail_quote">2017-08-04 17:27 GMT+02:0=
0 Even Rouault <span dir=3D"ltr">&lt;<a href=3D"mailto:even.rouault@spatial=
ys.com" target=3D"_blank">even.rouault@spatialys.com</a>&gt;</span>:<br><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex"><u></u>
<div style=3D"font-family:&#39;Sans Serif&#39;;font-size:9pt;font-weight:40=
0;font-style:normal"><span class=3D"">
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">On jeudi 3 ao=C3=BBt 2017 17:04:55 CEST Nicolas RUFF wr=
ote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; It seems best to block any negative size valu=
es from being passed into</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; these functions in the first place.  Libtiff =
is not in control of the I/O</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; functions, so it is best to assure that they =
are not passed illegal</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; values which might cause I/O implementations =
to do very bad things.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; Not sure to understand what you mean here. Here ar=
e all call locations</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; for SeekOK():</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; tif_dir.c : 2 times</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; tif_read.c : 4 times</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; tif_write.c : 1 time</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; tif_dirread.c : 3 times</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; tif_dirwrite.c : 9 times</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; Do you suggest to add an extra check for (off&lt;0=
) before each call? If</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; yes, I can prepare a patch.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
</span><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-=
right:0px;text-indent:0px">Before patching *all* those calls, I&#39;d start=
 with just the one (or the few ones) that are needed with your fuzzed file =
(blindly guessing that the issue is localized and not general...)</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">Opening a ticket in <a href=3D"http://bugzilla.maptools=
.org/enter_bug.cgi" target=3D"_blank">http://bugzilla.maptools.org/<wbr>ent=
er_bug.cgi</a> with the reproducer file and your proposed patch would be go=
od.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">Even</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">-- </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">Spatialys - Geospatial professional services</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px"><a href=3D"http://www.spatialys.com" target=3D"_blank">=
http://www.spatialys.com</a></p></div></blockquote></div><br></div>

--94eb2c0853f8001fff05562bdb83--

--===============2066096137==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
--===============2066096137==--
