From issues-return-1492-apmail-stdcxx-issues-archive=stdcxx.apache.org@stdcxx.apache.org Tue Apr 22 01:50:55 2008 Return-Path: Delivered-To: apmail-stdcxx-issues-archive@locus.apache.org Received: (qmail 81433 invoked from network); 22 Apr 2008 01:50:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Apr 2008 01:50:55 -0000 Received: (qmail 44051 invoked by uid 500); 22 Apr 2008 01:50:56 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 44032 invoked by uid 500); 22 Apr 2008 01:50:56 -0000 Mailing-List: contact issues-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list issues@stdcxx.apache.org Received: (qmail 44023 invoked by uid 99); 22 Apr 2008 01:50:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Apr 2008 18:50:56 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Apr 2008 01:50:01 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 93659234C0F3 for ; Mon, 21 Apr 2008 18:47:21 -0700 (PDT) Message-ID: <1878623557.1208828841589.JavaMail.jira@brutus> Date: Mon, 21 Apr 2008 18:47:21 -0700 (PDT) From: "Martin Sebor (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Closed: (STDCXX-60) std::istream::get(char*, size_type) doesn't store NUL on failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-60?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Sebor closed STDCXX-60. ------------------------------ Regression test added in [r650352|http://svn.apache.org/viewvc?rev=650352&view=rev]. > std::istream::get(char*, size_type) doesn't store NUL on failure > ---------------------------------------------------------------- > > Key: STDCXX-60 > URL: https://issues.apache.org/jira/browse/STDCXX-60 > Project: C++ Standard Library > Issue Type: Bug > Components: 27. Input/Output > Affects Versions: 4.1.2 > Environment: all > Reporter: Martin Sebor > Assignee: Martin Sebor > Fix For: 4.1.3 > > > The program below aborts at runtime. According to http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#243, > "...if the sentry constructor [of an unformatted input function] exits by throwing an exception or if the sentry object returns false, when converted to a value of type bool, the function returns without attempting to obtain any input. In either case [...] unformatted input functions taking a character array of non-zero size as an argument shall also store a null character (using charT()) in the first location of the array." > $ cat t.cpp && nice make t -r && ./t > #include > #include > int main () > { > std::istringstream strm; > strm.setstate (strm.failbit); > char s [3] = { 'x', 'y', 'z' }; > strm.get (s, 2); > assert ('\0' == s [0]); > assert ('y' == s [1]); > assert ('z' == s [2]); > } > gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -pthreads -D_RWSTD_USE_CONFIG -I/build/sebor/gcc-3.4.3-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include -I/build/sebor/dev/stdlib/tests/include -pedantic -nostdinc++ -g -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long t.cpp > gcc t.o -o t -L/build/sebor/gcc-3.4.3-15s/rwtest -lrwtest15s -pthreads -L/build/sebor/gcc-3.4.3-15s/lib -lstd15s -lsupc++ -lm > Assertion failed: '\0' == s [0], file t.cpp, line 13 > Abort (core dumped) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.