Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config file parsing #1151

Merged
merged 1 commit into from
Mar 11, 2023
Merged

Fix config file parsing #1151

merged 1 commit into from
Mar 11, 2023

Conversation

kephir4eg
Copy link
Contributor

Motivating case:

$ ./mergerfs -o config=any.conf aaa testmnt
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 2) > this->size() (which is 0)
Aborted (core dumped)

The content of the config file is irrelevant, the relevant stack is:

#10 0x000000000040cc4e in Branches::Impl::from_string (this=0x680540, s_="") at src/branches.cpp:316
#11 0x000000000040d8e7 in Branches::from_string (this=0x7fffffffc500, str_="") at src/branches.cpp:381
#12 0x000000000042da04 in Config::operator= (this=0x7fffffffc4d0, cfg_=...) at src/config.cpp:193
#13 0x000000000042ecab in Config::from_stream (this=0x666d80 <Config::_singleton>, istrm_=..., errs_=0x7fffffffd4b0) at src/config.cpp:302
#14 0x000000000042f93e in Config::from_file (this=0x666d80 <Config::_singleton>, filepath_="empty.conf", errs_=0x7fffffffd4b0) at src/config.cpp:341

The error happens while trying to assign the initial config object to the new instance in Config::from_stream. Empty branch (initial value) cannot be parsed by from_branch(). In fact having branch= line in the config would have the same result.

I also created a test, which explains the issue.

@trapexit trapexit merged commit bd02bfd into trapexit:master Mar 11, 2023
@trapexit
Copy link
Owner

Thanks. I knew that issue was there but hadn't gotten around to addressing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants