From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12249 invoked by alias); 23 Feb 2003 12:06:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12230 invoked by uid 71); 23 Feb 2003 12:06:00 -0000 Resent-Date: 23 Feb 2003 12:06:00 -0000 Resent-Message-ID: <20030223120600.12228.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 12104 invoked by uid 48); 23 Feb 2003 12:03:45 -0000 Message-Id: <20030223120345.12103.qmail@sources.redhat.com> Date: Sun, 23 Feb 2003 12: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++/9817: collate::compare doesn't handle nul characters. X-SW-Source: 2003-02/txt/msg01154.txt.bz2 List-Id: >Number: 9817 >Category: libstdc++ >Synopsis: collate::compare doesn't handle nul characters. >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Feb 23 12:06:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: peturr02@ru.is >Release: gcc-3.2.1 >Organization: >Environment: Red Hat Linux 8.0 >Description: collate::compare stops when it finds a nul character in the string, thus the strings "a\0a" and "a\0b" compare equal. >How-To-Repeat: See attachment. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="collatebug.cc" Content-Disposition: inline; filename="collatebug.cc" #include #undef NDEBUG #include int main() { using namespace std; typedef collate collate_type; locale loc = locale::classic(); const collate_type& coll = use_facet(loc); char str1[] = { 'a', '\0', 'a' }; char str2[] = { 'a', '\0', 'b' }; assert(coll.compare(str1, str1 + 3, str2, str2 + 3) < 0); return 0; }