#13 infinite loop in airOneLinify()

Bug
open
nobody
None
5
2014-04-02
2014-04-02
dperry
No

found a subtle bug in airOneLinify(..) in the air. With the right kind of file the first loop int the function becomes an infinite loop.

I found it by trying to load a symbolic link file generated on linux on a windows machine/filesystem (thanks rsync).. the file starts with valid characters but then changes to invalid characters (ie non-printable). So teem successfully detects it's not a valid nrrd, but then while formatting an error string containing the first line of the file (formatting occurs in air) it enters an infinite loop. Specifically within airOneLinify, after it reaches the non-printable characters, each iteration decrements i (because of the invalid character) and it never reaches the value len. Hopefully that makes sense..

The attached one line fix adds a decrement to the value "len", so whenever the inner loop essentially shortens the string "s" (due to invalid char), "len" is correctly adjusted too, so that as long as "len" was initially larger than "i" it should always terminate.

I don't think this changes creates any problems, but please advise if it does, as I am using this fix in my code.. Thanks!

1 Attachments

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks