Subject: [Boost-bugs] [Boost C++ Libraries] #11963: Boost function "boost::property_tree::ini_parser::read_ini" causing "EXC_BAD_ACCESS (code=EXC_I386_GPFLT)"
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-08 08:51:11
#11963: Boost function "boost::property_tree::ini_parser::read_ini" causing
"EXC_BAD_ACCESS (code=EXC_I386_GPFLT)"
----------------------------------+---------------------------
Reporter: giovacchini.andrea@⦠| Owner: cornedbee
Type: Bugs | Status: new
Milestone: To Be Determined | Component: property_tree
Version: Boost 1.60.0 | Severity: Problem
Keywords: |
----------------------------------+---------------------------
I have a simple source like this that build and executes correctly under
Windows 10 with Visual Studio 2015 but throws "EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)" under OsX 10.11.3 with Xcode 7.2.1:
{{{
#include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
if (argc != 3)
{
std::cerr << "Usage: program rootPath iniFileName" << std::endl ;
return 1;
}
string mainPath(argv[1]) ;
string iniFileName(argv[2]) ;
boost::property_tree::ptree pt;
try
{
boost::property_tree::ini_parser::read_ini(mainPath + iniFileName,
pt);
}
catch(const boost::property_tree::ptree_error &e)
{
cout << e.what() << endl;
}
return 0;
}
}}}
This is the stack trace:
Thread 1Queue : com.apple.main-thread (serial)
#0 0x00000001000a10c0 in std::__1::basic_streambuf<char,
std::__1::char_traits<char> >::pubimbue(std::__1::locale const&) [inlined]
at
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/streambuf:227
#1 0x00000001000a10c0 in std::__1::basic_ios<char,
std::__1::char_traits<char> >::imbue(std::__1::locale const&) [inlined] at
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:717
#2 0x00000001000a100b in void
boost::property_tree::ini_parser::read_ini<boost::property_tree::basic_ptree<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > > >
>(std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > const&,
boost::property_tree::basic_ptree<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > > >&,
std::__1::locale const&) at
/Users/andreagiovacchini/Documents/Sviluppo/boost_1_60_0/boost/property_tree/ini_parser.hpp:167
#3 0x0000000100124a36 in main at
/Users/andreagiovacchini/Documents/Sviluppo/Test/Test/main.cpp:21
#4 0x00007fff857245ad in start ()
Problem comes from "stream.imbue(loc);" line in ini_parser.php from this
function:
{{{
template<class Ptree>
void read_ini(const std::string &filename,
Ptree &pt,
const std::locale &loc = std::locale())
{
std::basic_ifstream<typename Ptree::key_type::value_type>
stream(filename.c_str());
if (!stream)
BOOST_PROPERTY_TREE_THROW(ini_parser_error(
"cannot open file", filename, 0));
stream.imbue(loc);
try {
read_ini(stream, pt);
}
catch (ini_parser_error &e) {
BOOST_PROPERTY_TREE_THROW(ini_parser_error(
e.message(), filename, e.line()));
}
}
}}}
Since I can't see how my code can generate this kind of problem I think it
is a Boost bug
Andrea
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11963> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC