Boost logo

Boost :

Subject: Re: [boost] [1.48 lexical_cast] Illegal Derefence
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2011-11-02 14:00:38


2011/11/2 Olaf van der Spek <ml_at_[hidden]>:
> Eh, why would you delay the fix?
> It seems like a serious issue.

This patch fixes the bug in more portable way:

@@ -1147,7 +1147,7 @@
                 bool const result = !(stream << input).fail();
                 start = stringbuffer.pbase();
                 finish = stringbuffer.pptr();
- return result;
+ return result && (start != finish);
             }

             template <class T>

All lexical_cast tests successfully passed with this patch on
clang-linux-2.9, gcc-4.4, gcc-4.5 and gcc-4.6.
This patch replaces Segmentation Fault with bad_lexical_cast exception
(tested on code provided by Olaf van der Spek).

OK to merge to release branch?

Best regards,
Antony Polukhin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk