IBM Support

LI81497: SEGFAULT/DOUBLE-FREE CORRUPTION WHEN STD::STRING ARRAY IS INITIALIZED IN STRUCT

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • SEGFAULT/DOUBLE-FREE CORRUPTION WHEN STD::STRING ARRAY IS
    INITIALIZED IN STRUCT USING XL C/C++FOR LINUX, V16.1
    ----------------------------------------------------------------
    
    xlc++ -std=c++11 -o test main.cpp
    
    ./test
    *** Error in `./test': double free or corruption (fasttop):
    0x000001003b130010 ***
    ======= Backtrace: =========
    /lib64/libc.so.6(cfree+0x49c)[0x3fffaba49bec]
    /lib64/libstdc++.so.6(_ZdlPv+0x20)[0x3fffabdc8d30]
    /lib64/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x18)[0x3ff
    fabe58e68]
    /lib64/libstdc++.so.6(+0x6850c)[0x3fffabda850c]
    /lib64/libstdc++.so.6(_ZNSsD1Ev+0x64)[0x3fffabe58f24]
    ./test[0x100008a0]
    ./test[0x100009b0]
    ./test[0x10000a18]
    /lib64/libc.so.6(+0x25280)[0x3fffab9d5280]
    /lib64/libc.so.6(__libc_start_main+0xc4)[0x3fffab9d5474]
    
    ================================================================
    
    Test Case:
    
    #include <array>
    #include <string>
    
    struct TestStruct
    {
      std::array<std::string, 1> arr = {{"one"}};
    };
    
    int main(void)
    {
      TestStruct s;
      return 0;
    }
    

Local fix

  • N/A
    

Problem summary

  • SEGFAULT/DOUBLE-FREE CORRUPTION WHEN STD::STRING ARRAY IS
    INITIALIZED IN STRUCT
    

Problem conclusion

  • The problem is with the code for handling the init list, the
    code checked for presence of both an exprWithCleanups and
    cxxDefaultInitExpr but did not handle both being present.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI81497

  • Reported component name

    XL C/C++ LINUX

  • Reported component ID

    5725C7310

  • Reported release

    G11

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2020-05-10

  • Closed date

    2020-06-23

  • Last modified date

    2020-06-23

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL C/C++ LINUX

  • Fixed component ID

    5725C7310

Applicable component levels

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"G11","Line of Business":{"code":"LOB17","label":"Mainframe TPS"}}]

Document Information

Modified date:
24 June 2020