Uploaded image for project: 'OpenSAML - C++'
  1. OpenSAML - C++
  2. CPPOST-70

Problem calling virtual functions from base class constructors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.4.1, 2.4.2, 2.4.3
    • Fix Version/s: 2.5.0
    • Component/s: SAML 1, SAML 2
    • Labels:
      None
    • Environment:

      Solaris 10, both archs, compiler package version > 12.0

    • Operating System:
      Solaris
    • CPU Type:
      Multiple
    • C/C++ Compiler:
      Oracle/Sun Studio

      Description

      Since at least 12.2 of SunStudio, running unit tests crashes in a test case that clones an AuthenticationStatement. The crash shows a stack trace that isn't possible, and the this pointer changes in the debugger across calls such that the compiler seems to be trashing the object in some way when it executes the call.

      I've traced it to the use of virtual methods inside base class constructors, in this case SubjectStatementImpl calling setSubject, which calls a virtual releaseDOM method. Moving that down to the subclass constructor fixes the crash.

      It should be possible to rework these clone operations as two stages, one to initialize an empty object via copy constructor, and then an internal _clone method that actually copies the content.

        Attachments

          Activity

            People

            Assignee:
            cantor.2@osu.edu Scott Cantor
            Reporter:
            cantor.2@osu.edu Scott Cantor
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 week
                1w
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 days, 10 minutes Time Not Required
                3d 10m