FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

LinkBack Thread Tools
Old 11-10-2010, 10:08 PM
Guillaume Gimenez
Default Bug#603113: libstdc++6: SIGSEGV in sort(rndit, rndit,cmp) with cmp modifying vector outside boundaries

Package: libstdc++6
Version: 4.4.5-6
Severity: normal

The following code segfaults when copying rhs in cmp:perator()
because it's a dangling reference. it appends at the 2nd iteration.

It worked previously but I can't say since how long it does not work,
recently I guess.

Yet it should be possible to manipulate the vector during the comparison
if we take care to do so outside the limits imposed by the iterators.

Best regards,


#include <vector>
#include <algorithm>
#include <string>

using namespace std;
class cmp : binary_function<bool,string,string> {
vector<string>& vec;
cmp(vector<string>& v) : vec(v) {}
bool operator()(const string& lhs, const string& rhs) {
return lhs<rhs;
int main(int argc, char **argv) {

vector<string> vec;
vec.push_back("lundi"); vec.push_back("mardi");
vec.push_back("mercredi"); vec.push_back("jeudi");
vec.push_back("vendredi"); vec.push_back("samedi");


return 0;

-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1,

Architecture: amd64 (x86_64)

Kernel: Linux 2.6.34-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libstdc++6 depends on:
ii gcc-4.4-base 4.4.5-6 The GNU Compiler Collection
ii libc6 2.11.2-7 Embedded GNU C Library:
Shared lib

ii libgcc1 1:4.4.5-6 GCC support library

libstdc++6 recommends no packages.

libstdc++6 suggests no packages.

-- no debconf information

To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4CDB25EF.7010108@free.fr">http://lists.debian.org/4CDB25EF.7010108@free.fr

Thread Tools

All times are GMT. The time now is 07:33 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org