Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 4934 invoked from network); 9 Dec 2005 01:31:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Dec 2005 01:31:33 -0000 Received: (qmail 27752 invoked by uid 500); 9 Dec 2005 01:31:33 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 27684 invoked by uid 500); 9 Dec 2005 01:31:32 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 27670 invoked by uid 99); 9 Dec 2005 01:31:32 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2005 17:31:29 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id CC9D318B for ; Fri, 9 Dec 2005 02:31:08 +0100 (CET) Message-ID: <482292876.1134091868835.JavaMail.jira@ajax.apache.org> Date: Fri, 9 Dec 2005 02:31:08 +0100 (CET) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Resolved: (STDCXX-59) std::istream::getline(char*, size_type) doesn't store NUL on failure In-Reply-To: <1467319206.1130448535475.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/STDCXX-59?page=all ] Martin Sebor resolved STDCXX-59: -------------------------------- Resolution: Fixed Fixed. To be closed after a test exercising this has been added to the test suite. > std::istream::getline(char*, size_type) doesn't store NUL on failure > -------------------------------------------------------------------- > > Key: STDCXX-59 > URL: http://issues.apache.org/jira/browse/STDCXX-59 > Project: STDCXX > Type: Bug > Components: 27. Input/Output > 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 lib.istream.unformatted, p20: > "[getline...] stores a null character (using charT()) into the next successive 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.getline (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. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira