diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index e6f4e75f5..321e75aca 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -319,6 +319,13 @@ namespace libtorrent int ret = load_file(filename, buf); if (ret < 0) return; + if (buf.empty()) +#ifndef BOOST_NO_EXCEPTIONS + throw invalid_torrent_file(); +#else + return; +#endif + lazy_entry e; lazy_bdecode(&buf[0], &buf[0] + buf.size(), e); std::string error;