Here’s an infinite loop that will hang your machine


Don’t try running this code:


 


CREATE CURSOR test (name c(10),data m)


*_vfp.EditorOptions=”LQT”


INSERT INTO test VALUES (“fred”,”test http://www.msn.com”+CHR(0)+” other stuff”)


MODIFY MEMO data nowait


 


It creates an in memory table of 2 fields: a Character and a Memo field. It then inserts into the Memo field a string that looks like a hyperlink with a null terminator. An editor window is brought up to display the memo data.


 


The code to determine whether or not there is a hyperlink and it’s length is about 70 lines of code. It has to accommodate various forms of hyperlinks and double byte characters. It failed to handle the case where the hyperlink has a null terminator, and thus caused an infinite loop. This was very simple to fix.


 


One workaround is to use the _vfp.EditorOptions command to disable hyperlinks


 


 

Comments (4)

  1. Magnussen says:

    Thanks for the tip! Because I was just about to run that code when I discovered this post!

  2. Fgarzonhz says:

    I do not see your solution the most suitable, you indicate that we should disable the option in I edit, this would provoke that we lose one of the kindness that VFP offers to us.

    I believe that this should validate internally. Regards.

  3. SparkyMarkyy says:

    Dear Sir,

     I read your article about your old chess program back in IBM dos that took 3 seconds to do a 40 move game.

     I was wondering what steps I would need to do in order to possibly write a chess program. Ive been playing chess now for 10 years, and i have some ideas that i want to impliment in a program. im curious.

     thanks for your time,

    SparkyMarkyy

    email = Sparkymark10419@aol.com

    –Mark

  4. Tod Mckenna says:

    Thanks Calvin,

    I’m always looking for ways to disgruntle my end users!