IBM Support

IC70308: CALLING API THAT USES SQLB_TBSPQRY_DATA RESULTS IN MEMORY CORRUPTION IN 9.7

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • Calling an API that uses the SQLB_TBSPQRY_DATA structure, for
    example sqlbftpq(), results in memory corruption in the
    application's address space. This problem only happens for
    applications compiled on DB2 UDB releases older than 9.7. The
    reason for this behaviour is the fact that on 9.7,
    SQLB_TBSPQRY_DATA is four bytes longer than what it
    used to be before 9.7.
    
    Excerpt from struct SQLB_TBSPQRY_DATA before 9.7:
    0x00000000000000B0    char                lifeLSN[6]
    0x00000000000000B6    char                pad[2]
    
    Excerpt from struct SQLB_TBSPQRY_DATA in 9.7:
    0x00000000000000B0    sqluint64           lifeLSN
    
    In other words, in the pre-97versions lifeLSN used to be a six
    byte character followed by a two byte padding. In 9.7 lifeLSN
    has become an sqluint64 whose total size is eight bytes.
    
    Despite the equal byte length, the new sqluint64 requires
    a 4 byte internal alignment which is implicitly added by the
    C compiler, hence the overall size of the
    SQLB_TBSPQRY_DATA structure is four bytes larger.
    

Local fix

  • Recompile the old applications on DB2 UDB 9.7.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * All users on DB2 v9.7 Fix Pack 3 and below                   *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * Calling an API that uses the SQLB_TBSPQRY_DATA structure,    *
    * for                                                          *
    * example sqlbftpq(), results in memory corruption in the      *
    *                                                              *
    * application's address space. This problem only happens for   *
    *                                                              *
    * applications compiled on DB2 UDB releases older than 9.7.    *
    * The                                                          *
    * reason for this behaviour is the fact that on 9.7,           *
    *                                                              *
    * SQLB_TBSPQRY_DATA is four bytes longer than what it          *
    *                                                              *
    * used to be before 9.7.                                       *
    *                                                              *
    *                                                              *
    *                                                              *
    * Excerpt from struct SQLB_TBSPQRY_DATA before 9.7:            *
    *                                                              *
    * 0x00000000000000B0    char                lifeLSN[6]         *
    *                                                              *
    * 0x00000000000000B6    char                pad[2]             *
    *                                                              *
    *                                                              *
    *                                                              *
    * Excerpt from struct SQLB_TBSPQRY_DATA in 9.7:                *
    *                                                              *
    * 0x00000000000000B0    sqluint64          lifeLSN             *
    *                                                              *
    *                                                              *
    *                                                              *
    * In other words, in the pre-97versions lifeLSN used to be a   *
    * six                                                          *
    * byte character followed by a two byte padding. In 9.7        *
    * lifeLSN                                                      *
    * has become an sqluint64 whose total size is eight bytes.     *
    *                                                              *
    *                                                              *
    *                                                              *
    * Despite the equal byte length, the new sqluint64 requires    *
    *                                                              *
    * a 4 byte internal alignment which is implicitly added by the *
    *                                                              *
    * C compiler, hence the overall size of the                    *
    *                                                              *
    * SQLB_TBSPQRY_DATA structure is four bytes larger.            *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 V9.7 Fix Pack 4                               *
    ****************************************************************
    

Problem conclusion

  • Problem firest fixed in DB2 V9.7 Fix Pack 4
    

Temporary fix

Comments

APAR Information

  • APAR number

    IC70308

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-07-30

  • Closed date

    2011-05-02

  • Last modified date

    2011-05-02

  • 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

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSY

       UP



Document information

More support for: DB2 for Linux, UNIX and Windows

Software version: 9.7

Reference #: IC70308

Modified date: 02 May 2011