boostorg / property_tree

Boost.org property_tree module
http://boost.org/libs/property_tree
55 stars 92 forks source link

Improve robustness of INI parser by refusing NULL characters #98

Open bubnikv opened 2 years ago

bubnikv commented 2 years ago

We are facing a weird issue on Windows, where a file move operation is not atomic: It seems to copy the file and sometimes it produces files that start normally, but then end filled with NULL characters. It looks as if a buffer was prepared, possibly memory mapped and then never filled.

Unfortunately the property_tree ini parser parses such files in many cases. Would it be possible to throw an exception on NULL characters, possibly as an option? Other characters below ASCII 32 excluding CR, LF, TAB may possibly be refused as well.

ashtum commented 9 months ago

@bubnikv This appears to be an issue in your specific use-case. Changing the library's behavior to fix it might not be the right choice. Have you tried reading the file, applying the necessary filtration, and then passing an std::string to the parser?