A C++ exception of type 'std::ios_base::failure' is being thrown which is not handled by the exception handler

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 4 - All architectures
  • Red Hat Enterprise Linux 5 - All architectures
  • Red Hat Enterprise Linux 6 - All architectures

Issue

  • A C++ exception of type 'std::ios_base::failure' is being thrown which is not handled by the exception handler
  • Opening a non existing file throws an 'std::ios_base::failure' exception, calling SIGABRT

Resolution

This package "libgcc-4.1-32bit-4.1.2_20070115-0.2.x86_64" has provided its own /lib/libgcc.so.1 file. Restore this file from the provided Red Hat package.

Root Cause

A non standard (third party) /lib/libgcc.so.1 supplied by a third party. This can override (and change) behaviour in the libstdc++ libraries exception handling abilities.

Diagnostic Steps

** The systems /lib/libgcc.so.1 (or /lib64/libgcc*) has been modified.

The rpm database maintains a comprehensive database of the status of installed files. Packages can be validated by RPM using the verify parameter.

# rpm -V libgcc
SM5....T   /lib/libgcc.so.1

These flags show that the following file attributes have been changed. This may differ on your local machine. For more information see this section of the RPM manual.

S is the file size.
M is the file's mode.
5 is the MD5 checksum of the file.
T is the modification time of the file. 
  • A program written in C++ crashes with a similar stack trace:
Stack trace :
#0 0x00007f92a6e638a5 in raise () from ./lib64/libc.so.6
#1 0x00007f92a6e65085 in abort () from ./lib64/libc.so.6
#2 0x00007f92a7505a5d in __gnu_cxx::__verbose_terminate_handler() () from ./usr/lib64/libstdc++.so.6
#3 0x00007f92a7503be6 in ?? () from ./usr/lib64/libstdc++.so.6
#4 0x00007f92a7503c13 in std::terminate() () from ./usr/lib64/libstdc++.so.6
#5 0x00007f92a7503d0e in __cxa_throw () from ./usr/lib64/libstdc++.so.6
#6 0x00007f92a74a89da in std::__throw_ios_failure(char const*) () from ./usr/lib64/libstdc++.so.6
#7 0x00007f92a74bb221 in std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate) () from ./usr/lib64/libstdc++.so.6
#8 0x00007f9aa74ba2da in .....

This frame #8 and below would be preceded, by application code.

  • Component
  • gcc

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments