[QFJ-198] Comment line ending file creates infinite loop in Session Settings Created: 15/Jun/07  Updated: 04/Jul/07  Resolved: 15/Jun/07

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.1.0
Fix Version/s: 1.2.0

Type: Bug Priority: Default
Reporter: Nick Fortescue Assignee: Jörg Thönnes
Resolution: Fixed Votes: 0
Labels: None


 Description   

If you create a configuration properties file which ends with a comment line with no carriage return, SessionSettings will go into an infinite loop when it tries to read it. This is because of the comment line handing code in lines 502-510 in SessionSettings. A change could either be made to isNewLineCharacter(), (which might have unintended side effects with the other places it is called) or in the condition on the while loop.



 Comments   
Comment by Jörg Thönnes [ 15/Jun/07 ]

Yes, the check for end-of-file is missing.

isNewLineCharacter() is also used here:

private boolean isValueCharacter(char ch)

{ return !isEndOfStream(ch) && !isNewLineCharacter(ch); }

This is the only other occurence. But look! This is the condition we need!

So replacing the condition by isValueCharacter(ch) would solve this issue:

} else if (ch == '#') {
do

{ ch = nextCharacter(reader); }

while (isValueCharacter(ch));
return getToken(reader);
}

Comment by Jörg Thönnes [ 15/Jun/07 ]

Added unit test to verify the changed condition.

Generated at Sat Nov 23 07:16:53 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.