fixed leaking exception from bdecode on malformed input. Fixes #492
This commit is contained in:
parent
33912a0fb7
commit
e3eb59f477
|
@ -57,6 +57,7 @@ release 0.14.3
|
||||||
* Don't try IPv6 on windows if it's not installed
|
* Don't try IPv6 on windows if it's not installed
|
||||||
* move_storage fix
|
* move_storage fix
|
||||||
* fixed potential crash on shutdown
|
* fixed potential crash on shutdown
|
||||||
|
* fixed leaking exception from bdecode on malformed input
|
||||||
|
|
||||||
release 0.14.2
|
release 0.14.2
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#pragma warning(push, 1)
|
#pragma warning(push, 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -246,10 +245,20 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(*in == 'e');
|
TORRENT_ASSERT(*in == 'e');
|
||||||
++in; // 'e'
|
++in; // 'e'
|
||||||
ret = entry(entry::int_t);
|
ret = entry(entry::int_t);
|
||||||
ret.integer() = boost::lexical_cast<entry::integer_type>(val);
|
char* end_pointer;
|
||||||
|
#ifdef TORRENT_WINDOWS
|
||||||
|
ret.integer() = _strtoi64(val.c_str(), &end_pointer, 10);
|
||||||
|
#else
|
||||||
|
ret.integer() = strtoll(val.c_str(), &end_pointer, 10);
|
||||||
|
#endif
|
||||||
#ifdef TORRENT_DEBUG
|
#ifdef TORRENT_DEBUG
|
||||||
ret.m_type_queried = false;
|
ret.m_type_queried = false;
|
||||||
#endif
|
#endif
|
||||||
|
if (end_pointer == val.c_str())
|
||||||
|
{
|
||||||
|
err = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue