halfgaar / FlashMQ

FlashMQ is a fast light-weight MQTT broker/server, designed to take good advantage of multi-CPU environments
https://www.flashmq.org/
Open Software License 3.0
174 stars 24 forks source link

Errors while loading config should be handled #2

Closed quinox closed 3 years ago

quinox commented 3 years ago

This unexpectedly passes:

$ FlashMQ --test-config -c /dev/null
Config OK

$ ulimit -m 12345678
$ FlashMQ --test-config -c /dev/zero
Config OK

When I modify the code and call infile.exceptions(std::ifstream::failbit | std::ifstream::badbit); after opening infile they fail as expected:

$ FlashMQ --test-config -c /dev/null
basic_ios::clear: iostream error

$ FlashMQ --test-config -c /dev/zero
std::bad_alloc
halfgaar commented 3 years ago

Fixed in a general way, by checking for various types of invalid files or files that are too big.