Commit 5653

From: Robert Wilhelm (robert.wilhelm@gmx.net)
Date: Thu Aug 28 2003 - 01:41:41 EDT

  • Next message: Marco Innocenti: "Some more italian strings"

    I committed a fix for 5653 (RTF file makes valgrind unhappy).

    This shows us the joy of C++ programming:

    We had this code:

    char *szWork, szLoc;
    int iBase, iSize;
    UT_String sNewProp;

    szWork = sNewProp.substr(iBase, iSize-iBase).c_str(); // line 1
    szLoc = strstr(szWork,":"); // line 2

    Now UT_String::substr() returns a new UT_String object,
    which lives very short and will be detroyed at end of line 1.

    Therefore in line 2 we access already freed memory.

    Have fun,

    Robert



    This archive was generated by hypermail 2.1.4 : Thu Aug 28 2003 - 01:59:00 EDT