Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx1.pub.mailpod2-cph3.one.com ([10.27.25.11])
	by mailstorage18.cst.mailpod2-cph3.one.com with LMTP id AC31CgjFD1zcWAAAQS8vrQ
	for <filtered@awaresystems.be>; Tue, 11 Dec 2018 14:09:12 +0000
X-HalOne-ID: 54d7bd5b-fd4e-11e8-b0ec-e0d848957041
Received: from mail-yw1-f44.google.com (unknown [209.85.161.44])
	by mx1.pub.mailpod2-cph3.one.com (Halon) with ESMTPS
	id 54d7bd5b-fd4e-11e8-b0ec-e0d848957041;
	Tue, 11 Dec 2018 14:09:11 +0000 (UTC)
Received: by mail-yw1-f44.google.com with SMTP id i20so5462161ywc.5
        for <filtered@awaresystems.be>; Tue, 11 Dec 2018 06:09:11 -0800 (PST)
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
         :from:to:thread-topic:thread-index:date:message-id:references
         :in-reply-to:accept-language:content-language:mime-version:subject
         :precedence:list-id:list-unsubscribe:list-post:list-help
         :list-subscribe:cc:errors-to:sender;
        bh=3tSSvsZWjRnesj4NaaUlTr5x8YSl/xN2ZbpAKqdiOWc=;
        b=nY9XpJae4a5PNFjj+axXscwq/qdnQY9k50aoPsAxwWM8QmblijpIThKCS0x0BMG4QD
         bsNzbflc8wTqJNwErzUSPl2ue4HDVZX3F8kEUfZrkIehZbaXLNb6FtwzXxTB0isbhq7D
         AC6aDhTtYaDHvQA8yZTwOBBFYJrxPWaGrFSU4Fv51JZzFQ+U2K3Rnickaq/xlRnQ9n1B
         dwQUGHmg3NBeunkQIx/kQb7CGumlre0q6jTQbFUsSEkzvoKTACBIqXp4QJU467FY6heJ
         0YrqX3Pi0+gjWkmVID0+x2QbzihTpiYzqRyDvVJHx+xHOzt12HKLiNsT8NpfhY8OGc1F
         bL5w==
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com: domain of tiff-bounces@lists.osgeo.org designates 140.211.15.3 as permitted sender) smtp.mailfrom=tiff-bounces@lists.osgeo.org
X-Gm-Message-State: AA+aEWZLfTdDO2e/1ysh8xYr8wGnKMg88DhPjtrkJIVyhPGoaCGPoIO5
	tBWXDdWf2TIBiP2ajL1/eRPH9uD6dzRXQWKveS1OYgDbllSA5EE=
X-Received: by 2002:a81:b641:: with SMTP id h1mr16270415ywk.112.1544537350367;
        Tue, 11 Dec 2018 06:09:10 -0800 (PST)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 2002:a25:2943:0:0:0:0:0 with SMTP id p64csp607061ybp;
        Tue, 11 Dec 2018 06:09:09 -0800 (PST)
X-Google-Smtp-Source: AFSGD/WU5xMewTpypVX4EzZG8EFHeLmghct/C+pVP8HTI8BcqvgQvEIl+SrOMngZyGcsOogIk0zs
X-Received: by 2002:a17:902:6a8c:: with SMTP id n12mr16239835plk.85.1544537349257;
        Tue, 11 Dec 2018 06:09:09 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1544537349; cv=none;
        d=google.com; s=arc-20160816;
        b=hKLsKeru9IHDBSZg8qCU/Z+EpgmbEsTePWWEH8TzzXmic1tmT0bK9D75S8t7xbXWje
         LzTxIy8Tl0L7qtm+st5pE8WHNSgVwpOi/xdWGugVzxB3NvllLAub6DEbe5otF2C1saom
         gtRaWn5WX9jd+ekJmwg/RcNsBfN2Oc9rKtoUJkHAFMo2Dff6m3W1rYfGhwUdgadfuO/m
         0W/vytqKii6oetnfB+dZdvhFSqzj9eZEKTCqh3WpbM+ne+favowlIBmrRe9u45cE/Tmq
         mnG0teJhhxsw0TY+L9hH3uiztRqntILDJfHjiIm4dsCuS3uxQ/wLqjBnJBbkMFKWWvtX
         A/8Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=sender:errors-to:cc:list-subscribe:list-help:list-post
         :list-unsubscribe:list-id:precedence:subject:mime-version
         :content-language:accept-language:in-reply-to:references:message-id
         :date:thread-index:thread-topic:to:from;
        bh=3tSSvsZWjRnesj4NaaUlTr5x8YSl/xN2ZbpAKqdiOWc=;
        b=U/ISluj0iUGC0aWl8mPb7HPBs0AzeF3WpHOnqydJwPdZV5IVk/sJIcJA1sKmoYsWwX
         gK7pjst3Co4iIdOWsZlry3EuhroxMZMZJmjkIeZ/gvoa0fbOuoDb56f8YAF3imkEcwUB
         PqWOQ+I1bKNkP67WxpIVuZ7U3+jA6menGsu+gtfOlP0JeqOId7VybSNOl4JQMUTZezE3
         BMLCRuWDA9siRU5ODtI6HeGWAB4mUTeUx1Zqtrv61o/CtPMzNeB21i4logDbzZrDwiDD
         qTK07GeOr3a5Fa5JN7fRADhK7cjjRJXJ6Kp0vaROVnLuFFVbwVTbsVM5Pxt8gGGRwQgi
         L7/g==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of tiff-bounces@lists.osgeo.org designates 140.211.15.3 as permitted sender) smtp.mailfrom=tiff-bounces@lists.osgeo.org
Return-Path: <tiff-bounces@lists.osgeo.org>
Received: from lists.osgeo.org (osgeo6.osgeo.osuosl.org. [140.211.15.3])
        by mx.google.com with ESMTPS id f16si12264939pgb.140.2018.12.11.06.09.08
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 11 Dec 2018 06:09:09 -0800 (PST)
Received-SPF: pass (google.com: domain of tiff-bounces@lists.osgeo.org designates 140.211.15.3 as permitted sender) client-ip=140.211.15.3;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of tiff-bounces@lists.osgeo.org designates 140.211.15.3 as permitted sender) smtp.mailfrom=tiff-bounces@lists.osgeo.org
Received: from osgeo6.osgeo.osuosl.org (localhost [127.0.0.1])
	by lists.osgeo.org (Postfix) with ESMTP id 38836601524C;
	Tue, 11 Dec 2018 06:09:08 -0800 (PST)
Received: from EUR01-VE1-obe.outbound.protection.outlook.com
 (mail-oln040092066037.outbound.protection.outlook.com [40.92.66.37])
 by lists.osgeo.org (Postfix) with ESMTPS id CCFFA6146DC8
 for <tiff@lists.osgeo.org>; Tue, 11 Dec 2018 06:09:06 -0800 (PST)
Received: from VE1EUR01FT042.eop-EUR01.prod.protection.outlook.com
 (10.152.2.60) by VE1EUR01HT028.eop-EUR01.prod.protection.outlook.com
 (10.152.3.47) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1404.13; Tue, 11 Dec
 2018 14:09:04 +0000
Received: from AM4PR0401MB2306.eurprd04.prod.outlook.com (10.152.2.59) by
 VE1EUR01FT042.mail.protection.outlook.com (10.152.3.114) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id
 15.20.1425.16 via Frontend Transport; Tue, 11 Dec 2018 14:09:04 +0000
Received: from AM4PR0401MB2306.eurprd04.prod.outlook.com
 ([fe80::d505:9f38:c864:8e2f]) by AM4PR0401MB2306.eurprd04.prod.outlook.com
 ([fe80::d505:9f38:c864:8e2f%2]) with mapi id 15.20.1404.026; Tue, 11 Dec 2018
 14:09:04 +0000
From: Emmanuel Cosnard <emmanuel.cosnard@outlook.fr>
To: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
Thread-Topic: [Tiff] SeekOK and WriteOK
Thread-Index: AQHUkVaC2PFqky2OZkiEMYAOzy1dgqV5kUoAgAABB8g=
Date: Tue, 11 Dec 2018 14:09:04 +0000
Message-ID: <AM4PR0401MB23068B48C87AA88CC0D27095F7A60@AM4PR0401MB2306.eurprd04.prod.outlook.com>
References: <AM4PR0401MB2306B293098F2767AA91FE27F7A60@AM4PR0401MB2306.eurprd04.prod.outlook.com>,
 <alpine.GSO.2.20.1812110756500.14882@freddy.simplesystems.org>
In-Reply-To: <alpine.GSO.2.20.1812110756500.14882@freddy.simplesystems.org>
Accept-Language: fr-FR, en-US
Content-Language: fr-FR
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-incomingtopheadermarker: OriginalChecksum:C52814A282A94A3D76C7A7D147AF595B27906A03FE45F5EEF5FF2E6EEDF91709;
 UpperCasedChecksum:840934E9DF27B9D669F155E352D0EE61108628C695DE2C93E8F19C89B711198D;
 SizeAsReceived:7144; Count:46
x-tmn: [Ud6hhXyUEQF7mM9DtUcIjp+IewVNBXNS]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; VE1EUR01HT028;
 6:4H6k06rDNqy2IiMbYpf7sMnUtGko55eP2coOkWSxsI2IutiA/ODgYlgT6kcRUMHs3InjnUzUa+to3uWyuRAmSxyul/PwSagxFkNt64CuZqNGLMNWJlGEInPxEqx+ZYyEuwkspta2U8rpcn1K4EW3Ypc1CbXWnkXqj6q3IoZe7y8MqCJjerJF6ihxq1kmE/j4FreEME4l5b/ifPZ3AIIAv/yEuMn2pMkp67R/rKvAflnUXVRobBUNSvQL0Hk/+aa8V7T5PfljFsCVCO70EV1ohvOCmFs7X8W2OqXz+vPBW9VRaVGLg5P+pVY3KSfSt0vmxNO2eIezQH6FBmiGHhzvcj+prRsTjdvpBm3HW8yc9+CagX7DJEpfankiv5nCRrShPWjQRlURYMq+SsivGuiPhnoRNUZLfB8InBlwxIkgAKLvPjpLHofBzt5Dgl+EZmMtZ/hl+fyW5kQg9AisQCQI8Q==;
 5:ywZwr8EwXBBzq//nBH6o1xg0J8nk6yyDLDEWnp/o6jjXRdo/yc2YKm65kmjyS+QvlO9tVjuqLR6Y+TnuSExKu3ihvcBhVwePSc9Y5DBpaSlp1IvK08fuGvZL2sgzc9Ue4GW52VBbGYM0vJrDuqO5Z9PUoWzsGPOfOYkkQv1QVvY=;
 7:vz7VhRchCniQnEJnY9ErH1ovGT5nMLNkjTvxWWB2UBycbqsRSkzvMj7LX2PnkqThjsEfCAQ0rtqPvU+X1nej3qKtjzELq6AZpspDZXjDgFSLUizcqS0QKJnvGQDqe34LD6df1mLvDUcwHuoZV/fOSQ==
x-incomingheadercount: 46
x-eopattributedmessage: 0
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390098)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101475)(1601125500)(1701031045);
 SRVR:VE1EUR01HT028; 
x-ms-traffictypediagnostic: VE1EUR01HT028:
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058);
 SRVR:VE1EUR01HT028; BCL:0; PCL:0; RULEID:; SRVR:VE1EUR01HT028; 
x-microsoft-antispam-message-info: Y7aIFKvpqigTk315cN2xod8yghVecae9UJuXvBCO+FP9MMWtfU0eoGqbt4IIOLyv
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 5dab7a8a-ebdc-4bd9-9cfd-67cde50b170b
X-MS-Exchange-CrossTenant-Network-Message-Id: fc574904-d5a6-425d-517b-08d65f72357d
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 5dab7a8a-ebdc-4bd9-9cfd-67cde50b170b
X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2018 14:09:04.6688 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR01HT028
Subject: Re: [Tiff] SeekOK and WriteOK
X-BeenThere: tiff@lists.osgeo.org
X-Mailman-Version: 2.1.20
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.osgeo.org>
List-Unsubscribe: <https://lists.osgeo.org/mailman/options/tiff>,
 <mailto:tiff-request@lists.osgeo.org?subject=unsubscribe>
List-Post: <mailto:tiff@lists.osgeo.org>
List-Help: <mailto:tiff-request@lists.osgeo.org?subject=help>
List-Subscribe: <https://lists.osgeo.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.osgeo.org?subject=subscribe>
Cc: "tiff@lists.osgeo.org" <tiff@lists.osgeo.org>
Content-Type: multipart/mixed; boundary="===============3693651013075385037=="
Errors-To: tiff-bounces@lists.osgeo.org
Sender: "Tiff" <tiff-bounces@lists.osgeo.org>

--===============3693651013075385037==
Content-Language: fr-FR
Content-Type: multipart/alternative;
	boundary="_000_AM4PR0401MB23068B48C87AA88CC0D27095F7A60AM4PR0401MB2306_"

--_000_AM4PR0401MB23068B48C87AA88CC0D27095F7A60AM4PR0401MB2306_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello Bob,

Thanks for your answer!

I am using windows 64 bits.

Actually, I created my own TIFFWriteData function and I am now sure that it=
's the WriteOK that doesn't work on some occasion, but still have no idea w=
hy.

Best regards,

Emmanuel
________________________________
De : Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
Envoy=E9 : mardi 11 d=E9cembre 2018 14:01
=C0 : Emmanuel Cosnard
Cc : tiff@lists.osgeo.org
Objet : Re: [Tiff] SeekOK and WriteOK

On Tue, 11 Dec 2018, Emmanuel Cosnard wrote:

> Hello,
>
> I am using the function TIFFWriteData to write some data on a custome rat=
ionnal tag, and it seems, that on some rare occasion,
> if (SeekOK(tif, dir->tdir_offset) && WriteOK(tif, cp, cc))
> Is there a way to do some intelligent retry here, instead of returning an=
 error? Or can we know why the WriteOK or SeekOK didn't work properly?

You did not mention the operating system you are using or the size of
its native off_t type (or equivalent).  It might make a difference if
you are using tif_unix.c or tif_win32.c, and the capabilities of the
compiler and run-time when the library was compiled.

This is the underlying implementation of the check:

int _TIFFSeekOK(TIFF* tif, toff_t off)
{
     /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
     /* See http://bugzilla.maptools.org/show_bug.cgi?id=3D2726 */
     return off <=3D (~(uint64)0)/2 && TIFFSeekFile(tif,off,SEEK_SET)=3D=3D=
off;
}

One can see that the first check is that the offset must be within the
range of a signed 64-bit type.  The next check actually does the seek
and checks if the requested position was obtained.  This is a case
where the seek position might need to be in the range of a smaller
size.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

--_000_AM4PR0401MB23068B48C87AA88CC0D27095F7A60AM4PR0401MB2306_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Hello Bob,</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Thanks for your answer!</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
I am using windows 64 bits.<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Actually, I created my own TIFFWriteData function and I am now sure that it=
's the WriteOK that doesn't work on some occasion, but still have no idea w=
hy.<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Best regards,</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Emmanuel<br>
</div>
<div id=3D"appendonsend"></div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>De :</b> Bob Friesenhahn &lt;bf=
riesen@simple.dallas.tx.us&gt;<br>
<b>Envoy=E9 :</b> mardi 11 d=E9cembre 2018 14:01<br>
<b>=C0 :</b> Emmanuel Cosnard<br>
<b>Cc&nbsp;:</b> tiff@lists.osgeo.org<br>
<b>Objet :</b> Re: [Tiff] SeekOK and WriteOK</font>
<div>&nbsp;</div>
</div>
<div class=3D"BodyFragment"><font size=3D"2"><span style=3D"font-size:11pt;=
">
<div class=3D"PlainText">On Tue, 11 Dec 2018, Emmanuel Cosnard wrote:<br>
<br>
&gt; Hello,<br>
&gt;<br>
&gt; I am using the function TIFFWriteData to write some data on a custome =
rationnal tag, and it seems, that on some rare occasion,<br>
&gt; if (SeekOK(tif, dir-&gt;tdir_offset) &amp;&amp; WriteOK(tif, cp, cc))<=
br>
&gt; Is there a way to do some intelligent retry here, instead of returning=
 an error? Or can we know why the WriteOK or SeekOK didn't work properly?<b=
r>
<br>
You did not mention the operating system you are using or the size of <br>
its native off_t type (or equivalent).&nbsp; It might make a difference if =
<br>
you are using tif_unix.c or tif_win32.c, and the capabilities of the <br>
compiler and run-time when the library was compiled.<br>
<br>
This is the underlying implementation of the check:<br>
<br>
int _TIFFSeekOK(TIFF* tif, toff_t off)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp; /* Huge offsets, especially -1 / UINT64_MAX, can c=
ause issues */<br>
&nbsp;&nbsp;&nbsp;&nbsp; /* See <a href=3D"http://bugzilla.maptools.org/sho=
w_bug.cgi?id=3D2726">http://bugzilla.maptools.org/show_bug.cgi?id=3D2726</a=
> */<br>
&nbsp;&nbsp;&nbsp;&nbsp; return off &lt;=3D (~(uint64)0)/2 &amp;&amp; TIFFS=
eekFile(tif,off,SEEK_SET)=3D=3Doff;<br>
}<br>
<br>
One can see that the first check is that the offset must be within the <br>
range of a signed 64-bit type.&nbsp; The next check actually does the seek =
<br>
and checks if the requested position was obtained.&nbsp; This is a case <br=
>
where the seek position might need to be in the range of a smaller <br>
size.<br>
<br>
Bob<br>
-- <br>
Bob Friesenhahn<br>
bfriesen@simple.dallas.tx.us, <a href=3D"http://www.simplesystems.org/users=
/bfriesen/">
http://www.simplesystems.org/users/bfriesen/</a><br>
GraphicsMagick Maintainer,&nbsp;&nbsp;&nbsp; <a href=3D"http://www.Graphics=
Magick.org/">http://www.GraphicsMagick.org/</a><br>
Public Key,&nbsp;&nbsp;&nbsp;&nbsp; <a href=3D"http://www.simplesystems.org=
/users/bfriesen/public-key.txt">
http://www.simplesystems.org/users/bfriesen/public-key.txt</a><br>
</div>
</span></font></div>
</body>
</html>

--_000_AM4PR0401MB23068B48C87AA88CC0D27095F7A60AM4PR0401MB2306_--

--===============3693651013075385037==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVGlmZiBtYWls
aW5nIGxpc3QKVGlmZkBsaXN0cy5vc2dlby5vcmcKaHR0cHM6Ly9saXN0cy5vc2dlby5vcmcvbWFp
bG1hbi9saXN0aW5mby90aWZmCg==

--===============3693651013075385037==--
