[ quantlib-Bugs-3444220 ] ConvertOper string bug

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ quantlib-Bugs-3444220 ] ConvertOper string bug

SourceForge.net
Bugs item #3444220, was opened at 2011-11-28 08:25
Message generated for change (Tracker Item Submitted) made by daveblob
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3444220&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Dave Blob (daveblob)
Assigned to: Nobody/Anonymous (nobody)
Summary: ConvertOper string bug

Initial Comment:
ConvertOper::operator std::string() const tries to access a temporary variable after it is destroyed (xString becomes a reference to the deleted variable xTemp).  Here's a fix:

    ConvertOper::operator std::string() const {
        const OPER *xString;

        if (oper_->xltype == xltypeStr) {
            xString = oper_;
        } else {
            Xloper xTemp;
            Excel(xlCoerce, &xTemp, 2, oper_, TempInt(xltypeStr));
            xString = &xTemp;
        }
       
        return strConv(xString);
    }

Could be replaced with:

    ConvertOper::operator std::string() const {
        const OPER *xString;

        if (oper_->xltype == xltypeStr) {
            xString = oper_;
            return strConv(xString);
        } else {
            Xloper xTemp;
            Excel(xlCoerce, &xTemp, 2, oper_, TempInt(xltypeStr));
            xString = &xTemp;
            return strConv(xString);
        }  
    }

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3444220&group_id=12740

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev