From da4d9092b28863d7592cae17f1e97161bda91064 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 4 Jan 2008 12:31:49 +0000 Subject: 2008-01-04 Tatsuhiro Tsujikawa Fixed segmentation fault when bad torrent metainfo is parsed. Added dynamic_cast properly to detect the misconfiguration of metainfo and then throw exception or skip it. * src/DefaultBtContext.{h, cc} * test/DefaultBtContextTest.cc * src/AnnounceList.cc * src/CompactPeerListProcessor.cc * src/message.h * src/DefaultBtAnnounce.{h, cc} * test/DefaultBtAnnounceTest.cc * src/BencodeVisitor.cc --- src/BencodeVisitor.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/BencodeVisitor.cc') diff --git a/src/BencodeVisitor.cc b/src/BencodeVisitor.cc index 32a11308..b21585ee 100644 --- a/src/BencodeVisitor.cc +++ b/src/BencodeVisitor.cc @@ -75,10 +75,10 @@ void BencodeVisitor::visit(const Dictionary* d) void BencodeVisitor::visit(const MetaEntry* e) { if(dynamic_cast(e) != 0) { - visit((const Data*)e); + visit(reinterpret_cast(e)); } else if(dynamic_cast(e) != 0) { - visit((const List*)e); + visit(reinterpret_cast(e)); } else if(dynamic_cast(e) != 0) { - visit((const Dictionary*)e); + visit(reinterpret_cast(e)); } } -- cgit