public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc
@ 2003-09-21 15:01 peturr02 at ru dot is
2003-09-21 15:21 ` [Bug libstdc++/12352] " peturr02 at ru dot is
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: peturr02 at ru dot is @ 2003-09-21 15:01 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
Summary: Exception safety problems in src/localename.cc
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peturr02 at ru dot is
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
There are numerous exception safety problems in the file src/localename.cc
in the functions
locale::_Impl::_Impl(const _Impl& __imp, size_t __refs)
locale::_Impl::_Impl(const char* __s, size_t __refs)
void locale::_Impl::_M_replace_categories(const _Impl* __imp, category __cat)
void locale::_Impl::_M_install_facet(const locale::id* __idp, const facet* __fp)
For example, the construct
try
{
_M_caches = new const facet*[_M_facets_size];
for (size_t __i = 0; __i < _M_facets_size; ++__i)
_M_caches[__i] = 0;
}
catch(...)
{
delete [] _M_caches;
__throw_exception_again;
}
appears in both constructors. There are several problems with this code.
1) _M_caches is uninitialized before entering the try block, and the
only function that can throw is the call to operator new, so _M_caches is
always uninitialized when the delete[] statement is executed.
2) Resources allocated before entering the try block are leaked.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
@ 2003-09-21 15:21 ` peturr02 at ru dot is
2003-09-21 15:25 ` paolo at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: peturr02 at ru dot is @ 2003-09-21 15:21 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
------- Additional Comments From peturr02 at ru dot is 2003-09-21 11:06 -------
Created an attachment (id=4790)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4790&action=view)
Test case
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
2003-09-21 15:21 ` [Bug libstdc++/12352] " peturr02 at ru dot is
@ 2003-09-21 15:25 ` paolo at gcc dot gnu dot org
2003-09-21 21:53 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-09-21 15:25 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 671 bytes --]
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
paolo at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
------- Additional Comments From paolo at gcc dot gnu dot org 2003-09-21 14:08 -------
Hi Pétur. Indeed, your PR seems correct, but I cannot effectively make use of
the testcase: it never fails at runtime whichever value of iters (in the range
1-1000). Sorry if I'm missing something naive...
Thanks,
Paolo.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
2003-09-21 15:21 ` [Bug libstdc++/12352] " peturr02 at ru dot is
2003-09-21 15:25 ` paolo at gcc dot gnu dot org
@ 2003-09-21 21:53 ` pinskia at gcc dot gnu dot org
2003-09-22 12:49 ` paolo at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-21 21:53 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 727 bytes --]
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-09-21 20:51:12
date| |
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-09-21 20:51 -------
Moving it to confirmed based on Paolo Carlini's analysis and that Pétur gave a correct test case this
time.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
` (2 preceding siblings ...)
2003-09-21 21:53 ` pinskia at gcc dot gnu dot org
@ 2003-09-22 12:49 ` paolo at gcc dot gnu dot org
2003-09-26 2:25 ` cvs-commit at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-09-22 12:49 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
paolo at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |paolo at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
` (3 preceding siblings ...)
2003-09-22 12:49 ` paolo at gcc dot gnu dot org
@ 2003-09-26 2:25 ` cvs-commit at gcc dot gnu dot org
2003-09-26 2:37 ` paolo at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-26 2:25 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-09-26 00:22 -------
Subject: Bug 12352
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: paolo@gcc.gnu.org 2003-09-26 00:22:01
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/src: localename.cc
libstdc++-v3/include/bits: locale_classes.h
Added files:
libstdc++-v3/testsuite/22_locale/locale/cons: 12352.cc
Log message:
2003-09-25 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/12352
* src/localename.cc (locale::_Impl::_Impl(const _Impl&,
size_t)): Don't leak if memory allocations for _M_facets,
_M_caches, and _M_names fail.
(locale::_Impl::_Impl(const char*, size_t)): Ditto.
(locale::_Impl::_M_replace_categories(const _Impl*,
category)): Ditto.
(locale::_Impl::_M_install_facet(const locale::id*,
const facet*)): Ditto.
* include/bits/locale_classes.h (locale::locale(const locale&,
_Facet*)): Don't leak memory.
* testsuite/22_locale/locale/cons/12352.cc: New, from the PR.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t,
bool)): Qualify with std:: strcpy, tweak.
* include/bits/locale_classes.h
(locale::_Impl::_M_check_same_name): Qualify strcmp.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.1969&r2=1.1970
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/localename.cc.diff?cvsroot=gcc&r1=1.43&r2=1.44
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_classes.h.diff?cvsroot=gcc&r1=1.10&r2=1.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/locale/cons/12352.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
` (4 preceding siblings ...)
2003-09-26 2:25 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-26 2:37 ` paolo at gcc dot gnu dot org
2003-09-30 8:46 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-09-26 2:37 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
paolo at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
------- Additional Comments From paolo at gcc dot gnu dot org 2003-09-26 00:27 -------
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
` (5 preceding siblings ...)
2003-09-26 2:37 ` paolo at gcc dot gnu dot org
@ 2003-09-30 8:46 ` cvs-commit at gcc dot gnu dot org
2003-10-17 18:17 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-30 8:46 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-09-30 07:28 -------
Subject: Bug 12352
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: paolo@gcc.gnu.org 2003-09-30 07:28:52
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/src: localename.cc
Log message:
2003-09-30 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/12352 (cont)
* src/localename.cc (locale::_Impl::_Impl(const char*, size_t)):
Don't leak __cloc; don't leak if any of the _M_init_facet(...)
calls fail.
(locale::_Impl::_Impl(const _Impl&, size_t)): Tweak.
(locale::_Impl::~_Impl): Don't do anything if !_M_facets,
!_M_caches, !_M_names.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.1976&r2=1.1977
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/localename.cc.diff?cvsroot=gcc&r1=1.44&r2=1.45
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
` (6 preceding siblings ...)
2003-09-30 8:46 ` cvs-commit at gcc dot gnu dot org
@ 2003-10-17 18:17 ` pinskia at gcc dot gnu dot org
2004-01-19 0:13 ` cvs-commit at gcc dot gnu dot org
2004-01-19 0:14 ` paolo at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-17 18:17 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |3.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
` (7 preceding siblings ...)
2003-10-17 18:17 ` pinskia at gcc dot gnu dot org
@ 2004-01-19 0:13 ` cvs-commit at gcc dot gnu dot org
2004-01-19 0:14 ` paolo at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-19 0:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-01-19 00:13 -------
Subject: Bug 12352
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: paolo@gcc.gnu.org 2004-01-19 00:12:55
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/bits: locale_classes.h locale_facets.tcc
libstdc++-v3/src: locale.cc localename.cc
Log message:
2004-01-19 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/12352
PR libstdc++/12438
* include/bits/locale_classes.h (locale::locale(const locale&,
_Facet*)): Don't leak memory on exception.
* include/bits/locale_facets.tcc (locale::combine(const locale&)):
Likewise.
* src/locale.cc (locale::locale(const char*)): Likewise.
* src/localename.cc (locale::_Impl::~_Impl(),
locale::_Impl::_Impl(const _Impl&, size_t),
locale::_Impl::_Impl(const char*, size_t)): Likewise.
(locale::_Impl::_M_replace_categories(const _Impl*, category):
Tweak.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1464.2.165&r2=1.1464.2.166
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_classes.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1.2.3&r2=1.1.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.82.4.14&r2=1.82.4.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/locale.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.72.2.4&r2=1.72.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/localename.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.33.2.4&r2=1.33.2.5
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/12352] Exception safety problems in src/localename.cc
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
` (8 preceding siblings ...)
2004-01-19 0:13 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-19 0:14 ` paolo at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: paolo at gcc dot gnu dot org @ 2004-01-19 0:14 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.0 |3.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12352
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-01-19 0:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-21 15:01 [Bug libstdc++/12352] New: Exception safety problems in src/localename.cc peturr02 at ru dot is
2003-09-21 15:21 ` [Bug libstdc++/12352] " peturr02 at ru dot is
2003-09-21 15:25 ` paolo at gcc dot gnu dot org
2003-09-21 21:53 ` pinskia at gcc dot gnu dot org
2003-09-22 12:49 ` paolo at gcc dot gnu dot org
2003-09-26 2:25 ` cvs-commit at gcc dot gnu dot org
2003-09-26 2:37 ` paolo at gcc dot gnu dot org
2003-09-30 8:46 ` cvs-commit at gcc dot gnu dot org
2003-10-17 18:17 ` pinskia at gcc dot gnu dot org
2004-01-19 0:13 ` cvs-commit at gcc dot gnu dot org
2004-01-19 0:14 ` paolo at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).