220 40202 <0766c3b4-2f95-4c3a-a716-5b868551ecec@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Alberto Barbati <albertobarbati@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Should istream::read() be allowed to clobber the
 buffer beyond the file's size.
Date: Fri, 21 Sep 2018 00:05:32 -0700 (PDT)
Lines: 101
Approved: news@gmane.org
Message-ID: <0766c3b4-2f95-4c3a-a716-5b868551ecec@isocpp.org>
References: <21a506dd-40ae-4cae-986d-4f014de8d859@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_724_2116202034.1537513532903"
X-Trace: blaine.gmane.org 1537513410 22874 195.159.176.226 (21 Sep 2018 07:03:30 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 21 Sep 2018 07:03:30 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCPY5DV6RIMBBPVQSLOQKGQE3XUOL4A@isocpp.org Fri Sep 21 09:03:25 2018
Return-path: <std-proposals+bncBCPY5DV6RIMBBPVQSLOQKGQE3XUOL4A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw1-f72.google.com ([209.85.161.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCPY5DV6RIMBBPVQSLOQKGQE3XUOL4A@isocpp.org>)
	id 1g3FTI-0005pY-FG
	for gclcip-std-proposals@m.gmane.org; Fri, 21 Sep 2018 09:03:24 +0200
Original-Received: by mail-yw1-f72.google.com with SMTP id v144-v6sf5323898ywa.23
        for <gclcip-std-proposals@m.gmane.org>; Fri, 21 Sep 2018 00:05:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=MIstSXNMuFAJQ0yoLVXF5V2jbxvuTeLfpXh+oXPO4kQ=;
        b=No9EXazuX5515D/OFawf9gcZnQDMhiRVEcA2/X/KN97xH1OshaX5Hiaa3zhnzxzHGH
         m2Mmp/MA1j+wWXfobLfhe1YEEK0kRi8dDwo1HQTJB/QZG5R6/4nFVmwbeUJgVXOwFasS
         xx5XDzruBxMFZ5jMWpLH7dHTdlgX1XNZhEWTf0TYGtj2el1jT6RotYShRtXOr5KiXbjn
         CUimtbYA9aQ15/9KTy5UOmyjE8PBsJFgPwgOf0VQoGw3Wy4oB650d+PZ3UWJU+R71rvX
         FsbYYnZtTH7s1axInjXp97JlBXGV7Ka3PbiVbqAZNVE18VkrVxhNtyiE+zH52sab6zl8
         HYAw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=MIstSXNMuFAJQ0yoLVXF5V2jbxvuTeLfpXh+oXPO4kQ=;
        b=tc1tQIggCnniu43vHKfHNgeohLO4wt8iWvygt8DLS4VTbBAgnJWgHW1x0/q3RyNcfE
         5aO0MovxrQCXNAz8kBWSJZ5jcWRIlFNRuyQ8m2LnYPlnWlGw7DzlIkJ+Kh8E3+3B0waY
         NZI/J+ac1p1+btWJR9I+W35BO965uS2EwtiZNiDitKkNdAyLrHZVycJRoz3SBXtIx2DF
         JlC3L3dWntmMvrrv/JRhUvDHao8ju5M/mxVFkQL5ps+0g7EFQEIGdiMy5eZDcfFJ/cyo
         1XOwsN54AZwbAt31Tg1ODwLsAaYnxTWMGNyOrlNtd+nNXWTaKhyr2LgHe1ctytXZU5IK
         bgdw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=MIstSXNMuFAJQ0yoLVXF5V2jbxvuTeLfpXh+oXPO4kQ=;
        b=O94bYsygc5Ama2CB2QYTk1s/tCrci7eKl/9AWFkAhDBnS5Zc/jeKID1NDl96bcI8wV
         G7wjKpADUbqYblsca/pj4QJdKfatkwQhLcgA0qL2vavrw7rhCNAOlKUTUMK+rH0Syps+
         SmOnzPa536usgzitViS71VcOHLrUfdfvilUxkVlWqwKDGE06PHYWQ43L8Mvovn8bv0lY
         lwjoXau1/wfnJQAkp/2A1UJfdcd+tTxnH3QNojL0FkwkMtojwHV+041VRc8ce10wV7gm
         NniUPRxaO8aZvQNhrxTml2THvLLEZWEuUv8s4h3DW2zp/jFZYB8/eQD8/LmaKQsJrS6/
         iszg==
X-Gm-Message-State: APzg51BvpSjdBfHxpRpPyuy5MSrNB6CDjo5AiooyXa4kJ3ijAyCrc5Wt
	MzSoujtPUtcFhPHffUFNp1PKKA==
X-Google-Smtp-Source: ANB0VdYdgYKPdfBxIkuKfP5Xs3dqgvD/JqvtC5dgmPtkWlK3SE8DA8xvAwhsT36v6WQDEkYMM26cfg==
X-Received: by 2002:a25:5d6:: with SMTP id 205-v6mr1186622ybf.52.1537513534896;
        Fri, 21 Sep 2018 00:05:34 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a25:3cc:: with SMTP id 195-v6ls113742ybd.20.gmail; Fri, 21
 Sep 2018 00:05:33 -0700 (PDT)
X-Received: by 2002:a25:2483:: with SMTP id k125-v6mr154552ybk.5.1537513533705;
        Fri, 21 Sep 2018 00:05:33 -0700 (PDT)
In-Reply-To: <21a506dd-40ae-4cae-986d-4f014de8d859@isocpp.org>
X-Original-Sender: AlbertoBarbati@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:40202
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40202>

------=_Part_724_2116202034.1537513532903
Content-Type: multipart/alternative; 
	boundary="----=_Part_725_1483955140.1537513532904"

------=_Part_725_1483955140.1537513532904
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Il giorno gioved=C3=AC 20 settembre 2018 00:06:34 UTC+2, Bengt Gustafsson h=
a=20
scritto:
>
> When you do a read on an istream with a buffer larger than the file (in=
=20
> text mode) the MSVC was recently changed so that it may change bytes in t=
he=20
> buffer after the file length. The same goes for the C function fread().
>
> I'm unsure if the standard actually allows this behaviour. Microsoft=20
> recently changed the behaviour and it broke our test programs.
>
> Microsoft claims this is allowed, I think it is not logical to allow it.
>
> Is this behaviour allowed?=20
>

This is the relevant part of the standard:=20
http://eel.is/c++draft/istream.unformatted#30

It's not specifically allowed nor denied, so I guess it could be=20
interpreted to allow the Microsoft implementation.

If it is allowed, should it be?
>

If it allows a significant optimization, as stated by the Microsoft=20
developers involved, definitely it should, in my opinion. Accessing the=20
rest of the buffer pretending that it did not get overwritten is such a=20
special and, no offense, rather useless scenario. I much rather prefer to=
=20
have the main scenario optimized than having a specific corner case=20
"correct". Again, that's my opinion.

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/0766c3b4-2f95-4c3a-a716-5b868551ecec%40isocpp.or=
g.

------=_Part_725_1483955140.1537513532904
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Il giorno gioved=C3=AC 20 settembre 2018 00:06:34 UTC+2, B=
engt Gustafsson ha scritto:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"ltr">When you do a read on an istream with a buffer larger than th=
e file (in text mode) the MSVC was recently changed so that it may change b=
ytes in the buffer after the file length. The same goes for the C function =
fread().<div><br></div><div>I&#39;m unsure if the standard actually allows =
this behaviour. Microsoft recently changed the behaviour and it broke our t=
est programs.</div><div><br></div><div>Microsoft claims this is allowed, I =
think it is not logical to allow it.</div><div><br></div><div>Is this behav=
iour allowed? <br></div></div></blockquote><div><br></div><div>This is the =
relevant part of the standard: http://eel.is/c++draft/istream.unformatted#3=
0</div><div><br></div><div>It&#39;s not specifically allowed nor denied, so=
 I guess it could be interpreted to allow the Microsoft implementation.</di=
v><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">=
<div>If it is allowed, should it be?</div></blockquote><div><br></div><div>=
If it allows a significant optimization, as stated by the Microsoft develop=
ers involved, definitely it should, in my opinion. Accessing the rest of th=
e buffer pretending that it did not get overwritten is such a special and, =
no offense, rather useless scenario. I much rather prefer to have the main =
scenario optimized than having a specific corner case &quot;correct&quot;. =
Again, that&#39;s my opinion.</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0766c3b4-2f95-4c3a-a716-5b868551ecec%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0766c3b4-2f95-4c3a-a716-5b868551ecec=
%40isocpp.org</a>.<br />

------=_Part_725_1483955140.1537513532904--

------=_Part_724_2116202034.1537513532903--

.
