← Back to team overview

linuxdcpp-team team mailing list archive

[Bug 646172] Re: Don't provide fromCharset argument to Text::toUtf8

 

Not only in this code. I write you annother bugged code places.

File::File(std::string const&, int, int) (File.cpp:217): string filename = Text::fromUtf8(aFileName);
Util::initialize() (Util.cpp:102): boot.fromXML(File(systemPath + "dcppboot.xml", File::READ, File::OPEN).read());

File::ensureDirectory(std::string const&) (File.cpp:379): string file = Text::fromUtf8(aFile);
Util::initialize() (Util.cpp:123): File::ensureDirectory(configPath);

File::getSize(std::string const&) (File.cpp:372): if(stat(Text::fromUtf8(aFileName).c_str(), &s) == -1)
HashManager::HashStore::HashStore() (HashManager.cpp:416): if(File::getSize(getDataFile()) <= static_cast<int64_t>(sizeof(int64_t)))

File::findFiles(std::string const&, std::string const&) (File.cpp:425): DIR* dir = opendir(Text::fromUtf8(path).c_str());
CryptoManager::loadCertificates() (CryptoManager.cpp:207): StringList certs = File::findFiles(SETTING(TLS_TRUSTED_CERTIFICATES_PATH), "*.pem");

File::findFiles(std::string const&, std::string const&) (File.cpp:429): ret.push_back(path + Text::toUtf8(ent->d_name));
CryptoManager::loadCertificates() (CryptoManager.cpp:208): StringList certs2 = File::findFiles(SETTING(TLS_TRUSTED_CERTIFICATES_PATH), "*.crt");

-- 
Don't provide fromCharset argument to Text::toUtf8
https://bugs.launchpad.net/bugs/646172
You received this bug notification because you are a member of LinuxDC++
Team, which is subscribed to LinuxDC++.

Status in Linux DC++: New

Bug description:
Valgrind:


==3843== Invalid read of size 8
==3843==    at 0x76A8E12: __GI_strlen (strlen.S:31)
==3843==    by 0x764B341: iconv_open (iconv_open.c:52)
==3843==    by 0x4C8D7A: Text::convert(std::string const&, std::string&, std::string const&, 
std::string const&) (Text.cpp:326)
==3843==    by 0x4C9086: Text::toUtf8(std::string const&, std::string const&) (Text.cpp:296)
==3843==    by 0x4E34F4: Util::initialize() (Util.cpp:95)
==3843==    by 0x441598: startup(void (*)(void*, std::string const&), void*) (DCPlusPlus.cpp:
51)
==3843==    by 0x5A5F8B: main (wulfor.cc:61)


Util.cpp (95): configPath = home ? Text::toUtf8(home) + "/.dc++/" : "/tmp/";

This call not provide required argument 'charset' to 'toUtf8' function:

Text.cpp (290): string Text::toUtf8(const string& str, const string& charset) throw()

I don't know what real charset we can provide to function 'toUtf8', maybe depend on locale?





References