Bug 152293 - [libstdc++] SEGV in libstdc++.so.6
Summary: [libstdc++] SEGV in libstdc++.so.6
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.1-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-16 12:00 UTC by kenorb
Modified: 2018-07-16 19:10 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kenorb 2010-11-16 12:00:19 UTC
libstdc++.so.6 doing SEGV when run mysql-workbench-bin
#1  0x0000000808dc9bc1 in std::char_traits<char>::length (__s=0x0) at char_traits.h:258
#2  0x0000000808dcbe15 in std::string::assign (this=0x7fffffffe4b0, __s=0x0) at basic_string.h:920
#3  0x0000000808dcbe45 in std::string::operator= (this=0x7fffffffe4b0, __s=0x0) at basic_string.h:499

Backtrace:
(gdb) bt full
#0  0x00000008092c05b7 in strlen () from /lib/libc.so.7
#1  0x0000000808dc9bc1 in std::char_traits<char>::length (__s=0x0) at char_traits.h:258
#2  0x0000000808dcbe15 in std::string::assign (this=0x7fffffffe4b0, __s=0x0) at basic_string.h:920
#3  0x0000000808dcbe45 in std::string::operator= (this=0x7fffffffe4b0, __s=0x0) at basic_string.h:499
#4  0x000000000070a87a in main (argc=1, argv=0x7fffffffe768) at main.cpp:113

It should not pass NULL into libc.

See more: http://forums.freebsd.org/showthread.php?t=19387

Fix: 

Check if __s is NULL?

#2  0x0000000808dcbe15 in std::string::assign (this=0x7fffffffe4b0, __s=0x0) at basic_string.h:920
      /**
       *  @brief  Set value to contents of a C string.
       *  @param s  The C string to use.
       *  @return  Reference to this string.
       *
       *  This function sets the value of this string to the value of @a s.
       *  The data is copied, so there is no dependence on @a s once the
       *  function returns.
       */
      basic_string&
      assign(const _CharT* __s)
      {
  __glibcxx_requires_string(__s);
  return this->assign(__s, traits_type::length(__s));
#1  0x0000000808dc9bc1 in std::char_traits<char>::length (__s=0x0) at char_traits.h:258
      static size_t
      length(const char_type* __s)
      { return strlen(__s); }
How-To-Repeat: > mysql-workbench-bin
Segmentation fault
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:59 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Pedro F. Giffuni freebsd_committer freebsd_triage 2018-07-16 19:10:04 UTC
8.x or even 9.x are EOL'd and we don't really ship libstdc++ as part of the base system anymore.
It would be nice to use mysql-workbench on modern FreeBSD though (it should work, just haven't tried).