History log of /freebsd-current/contrib/libcxxrt/libelftc_dem_gnu3.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 12be6f12 09-May-2024 Justine Tunney <jtunney@gmail.com>

Fix memory corruption in C++ demangler

The __cxa_demangle_gnu3() and cpp_demangle_gnu3() functions segfault on
various libcxxabi test cases due to a copy and paste error. This change
fixes that.

This is a subset of https://github.com/libcxxrt/libcxxrt/pull/34 which
fixes the immediate problem.

Reviewed by: imp, emaste (I think)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1222


# 56aaed38 09-Mar-2022 Dimitry Andric <dim@FreeBSD.org>

Merge libcxxrt master fd484be8d1e94a1fcf6bc5c67e5c07b65ada19b6

Interesting fixes:
47661d0 Match libc++abi/libsupc++ when demangling array types
e44a05c Fix unitialized variable in __cxa_demangle_gnu3 after #6 (#8)
5088b05 Remove some code duplication.
fd484be Atomics cleanup (#11)

MFC after: 2 weeks


# d1498777 22-Feb-2021 Dimitry Andric <dim@FreeBSD.org>

Fix possibly unitialized variables in __cxa_demangle_gnu3()

After 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 where I imported a more
recent libcxxrt snapshot, the variables 'rtn' and 'has_ret' could in
some cases be used while still uninitialized. Most obviously this would
lead to a jemalloc complaint about a bad free(), aborting the program.

Fix this by initializing a bunch variables in their declarations. This
change has also been sent upstream, with some additional changes to be
used in their testing framework.

PR: 253226
MFC after: 3 days

# 0ee0dbfb 18-Feb-2021 Dimitry Andric <dim@FreeBSD.org>

Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456

Interesting fixes:
b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877
7b2335c Mostly fix __cxa_demangle after #3

Reported by: arichardson
PR: 253226
MFC after: 3 days


# 7b7921b4 04-Nov-2020 Dimitry Andric <dim@FreeBSD.org>

Make vector-related functions in libcxxrt's demangler static

Follow-up to r367323 by re-adding static to a number of the functions
copied from elftc's libelftc_vstr.c. This was requested by upstream.

PR: 250702
MFC after: 3 days

# a7941b33 04-Nov-2020 Dimitry Andric <dim@FreeBSD.org>

Update libcxxrt's private copy of elftoolchain demangler

This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with
the most recent version from upstream r3877. Similar to r367322, this
fixes a number of possible assertions, and allows it to correctly
demangle several names that it could not handle before.

PR: 250702
MFC after: 3 days

# 4a1f3708 25-Mar-2017 Dimitry Andric <dim@FreeBSD.org>

Import libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92.

Interesting fixes which were not already merged:
0c7c611 Merge C++ demangler bug fixes from ELF Tool Chain (#40)
2b208d9 __cxa_demangle_gnu3: demangle 'z' as '...', not 'ellipsis' (#41)

MFC after: 3 days


# 0fe76877 27-Jul-2016 Ed Maste <emaste@FreeBSD.org>

libcxxrt: fix demangling of wchar_t

'wchar_t' is 7 characters long, not 6. r303297 fixed this in libelftc,
but not the second copy of this file that we have in libcxxrt.

PR: 208661
Submitted by: Daniel McRobb
Obtained from: ELF Tool Chain r3480
MFC after: 3 days

# fa7477ce 18-Jun-2015 Ed Maste <emaste@FreeBSD.org>

Import libcxxrt master e64e93fe5bba67a6d52cbe5a97f8770c054bfa65.

This includes a number of demangler fixes obtained from upstream
ELF Tool Chain.

PR: 200913
Sponsored by: The FreeBSD Foundation


# 0f9eee39 23-Sep-2013 David Chisnall <theraven@FreeBSD.org>

Import a new libcxxrt. This fixes some potential crashing in the demangler.

Approved by: re (gjb)
MFC after: 1 week

# 7a984708 25-Nov-2011 David Chisnall <theraven@FreeBSD.org>

Import libc++ / libcxxrt into base. Not build by default yet (use
MK_LIBCPLUSPLUS=yes to enable). This is a work-in-progress. It works for
me, but is not guaranteed to work for anyone else and may eat your dog.

To build C++ using libc++, add -stdlib=libc++ to your CXX and LD flags.

Bug reports welcome, bug fixes even more welcome...

Approved by: dim (mentor)


# d1498777 22-Feb-2021 Dimitry Andric <dim@FreeBSD.org>

Fix possibly unitialized variables in __cxa_demangle_gnu3()

After 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 where I imported a more
recent libcxxrt snapshot, the variables 'rtn' and 'has_ret' could in
some cases be used while still uninitialized. Most obviously this would
lead to a jemalloc complaint about a bad free(), aborting the program.

Fix this by initializing a bunch variables in their declarations. This
change has also been sent upstream, with some additional changes to be
used in their testing framework.

PR: 253226
MFC after: 3 days


# 7b7921b4 04-Nov-2020 Dimitry Andric <dim@FreeBSD.org>

Make vector-related functions in libcxxrt's demangler static

Follow-up to r367323 by re-adding static to a number of the functions
copied from elftc's libelftc_vstr.c. This was requested by upstream.

PR: 250702
MFC after: 3 days


# a7941b33 04-Nov-2020 Dimitry Andric <dim@FreeBSD.org>

Update libcxxrt's private copy of elftoolchain demangler

This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with
the most recent version from upstream r3877. Similar to r367322, this
fixes a number of possible assertions, and allows it to correctly
demangle several names that it could not handle before.

PR: 250702
MFC after: 3 days


# 0fe76877 27-Jul-2016 Ed Maste <emaste@FreeBSD.org>

libcxxrt: fix demangling of wchar_t

'wchar_t' is 7 characters long, not 6. r303297 fixed this in libelftc,
but not the second copy of this file that we have in libcxxrt.

PR: 208661
Submitted by: Daniel McRobb
Obtained from: ELF Tool Chain r3480
MFC after: 3 days


# 0f9eee39 23-Sep-2013 David Chisnall <theraven@FreeBSD.org>

Import a new libcxxrt. This fixes some potential crashing in the demangler.

Approved by: re (gjb)
MFC after: 1 week