From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Received: (qmail 12849 invoked by uid 71); 9 Jan 2003 16:06:01 -0000 Resent-Date: 9 Jan 2003 16:06:01 -0000 Resent-Message-ID: <20030109160601.12848.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, peturr02@ru.is Received: (qmail 11417 invoked by uid 61); 9 Jan 2003 16:00:20 -0000 Message-Id: <20030109160020.11416.qmail@sources.redhat.com> Date: Thu, 09 Jan 2003 16:06:00 -0000 From: peturr02@ru.is Reply-To: peturr02@ru.is To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libstdc++/9247: codecvt does not return partial if output buffer too small X-SW-Source: 2003-01/txt/msg00607.txt.bz2 List-Id: >Number: 9247 >Category: libstdc++ >Synopsis: codecvt does not return partial if output buffer too small >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Jan 09 08:06:00 PST 2003 >Closed-Date: >Last-Modified: >Originator: peturr02@ru.is >Release: gcc-3.2.1 >Organization: >Environment: Red Hat Linux 8.0 >Description: If codecvt is passed an output buffer that is too small to hold the result of the conversion, but the conversion otherwise succeeds, ok is returned instead of partial. >How-To-Repeat: See attachment. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="sizebug.cc" Content-Disposition: inline; filename="sizebug.cc" #include int main() { using namespace std; typedef codecvt w_codecvt; locale loc; w_codecvt const& cvt = use_facet(loc); char const source[] = "abcdefghijklmnopqrstuvwxyz"; size_t size = sizeof(source) - 1; char const* from_next; wchar_t buffer[1024]; wchar_t* to_next; mbstate_t state; memset(&state, 0, sizeof(state)); codecvt_base::result res = cvt.in(state, source, source + size, from_next, buffer, buffer + 1, to_next); if (res == codecvt_base::ok) assert(from_next == source + size); return 0; }