All Projects

IDProjectCategoryTask TypeReported InPrioritySeveritySummaryStatusProgress  descDue Date
 213 POV-RayParser/SDLDefinite Bug3.70 RC3Very LowMedium Missing check for ios failbit/badbit: endless loop whil ...Closed
Task Description


this bug report relates to this thread:

In /unix/unixoptions.cpp around line 817:

while ( !Stream.eof() )
	// get and preprocess line
	std::getline(Stream, line);
	line = pre_process_conf_line(line);
	// skip empty line
	if(line.length() == 0)

`Stream.eof()` could never be true as well as `line.length()` always can be zero, leading to an endless loop. In my case, the problem occurred due to my ~/.povray/3.7/povray.conf being a directory instead of a file.

To fix the problem, one has to consolidate this loop by not only checking for eofbit, but also for failbit and badbit of `Stream`. The getline() method on a directory does not set the eofbit, but it sets fail and bad (test: According to fail and bad can be checked for by `!Stream`. A simple `if (!Stream) break;` within the loop fixes the problem (patch file attached).

Are there more missing checks on iostreams like this in the code? :) They should definitely be fixed.

Furthermore, one could think about using the boost filesystem library to be able to distinguish files and directories to provide good error messages.

Hope that helps,

Jan-Philip Gehrcke

Showing tasks 1 - 1 of 1 Page 1 of 1

Available keyboard shortcuts


Task Details

Task Editing