Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#383 POP3ClientSession crashes when compiled with VC++2010

open
nobody
Net (141)
5
2012-09-14
2010-09-16
mindlesskostya
No

The following code works well when compiled by VS2005 or VS2008, but crashes when compiled by VS2010. This is reproducible both with 1.3.6p2 release and with the current 1.3.7 branch from SVN.

POP3ClientSession pop3("host", 110);
pop3.login("user", "password");
POP3ClientSession::MessageInfoVec infos;
pop3.listMessages(infos);

for(POP3ClientSession::MessageInfoVec::iterator it = infos.begin(); it != infos.end(); ++it)
{
MailMessage msg;
pop3.retrieveMessage(it->id, msg); // <<< ACCESS VIOLATION HERE
}

Inside the poco sources, the crash is in:

void MessageHeader::read(std::istream& istr)
{
static const int eof = std::char_traits<char>::eof();
std::string name;
std::string value;
name.reserve(32);
value.reserve(64);
int ch = istr.get(); // <<<<< ACCESS VIOLATION HERE

Call stack:

Poco::Net::MessageHeader::read(std::basic_istream<char,std::char_traits<char> > & istr) Line 88 C++
Poco::Net::MailMessage::readHeader(std::basic_istream<char,std::char_traits<char> > & istr) Line 371 C++
Poco::Net::MailMessage::read(std::basic_istream<char,std::char_traits<char> > & istr, Poco::Net::PartHandler & handler) Line 245 C++
Poco::Net::POP3ClientSession::retrieveMessage(int id, Poco::Net::MailMessage & message, Poco::Net::PartHandler & handler) Line 235 C++

Discussion

  • Well, I'm starting to like VS2010 more and more every day.