Skip to content

Commit

Permalink
fix crash when reading .po files
Browse files Browse the repository at this point in the history
You may _never_ use the std:: file io functions
in wesnoth since they only support acii characters
on windows in filenames. We have fixed this many
times already but apparently the person that added
.po file support wasn't aware of this issue.

fixes #4965
  • Loading branch information
gfgtdf committed Jun 23, 2020
1 parent 57f8338 commit 498f7f3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/gettext_boost.cpp
Expand Up @@ -131,12 +131,11 @@ namespace
if(!filesystem::file_exists(path)) {
continue;
}
std::ifstream po_file;
po_file.exceptions(std::ios::badbit);
LOG_G << "Loading language file from " << path << '\n';
try {
po_file.open(path);
const po_catalog& cat = po_catalog::from_istream(po_file);
filesystem::scoped_istream po_file = filesystem::istream_file(path);
po_file->exceptions(std::ios::badbit);
const po_catalog& cat = po_catalog::from_istream(*po_file);
extra_messages_.emplace(get_base().domain(domain), cat);
} catch(const spirit_po::catalog_exception& e) {
throw_po_error(lang_name_long, domain, e.what());
Expand Down

0 comments on commit 498f7f3

Please sign in to comment.