Welcome to MSDN Blogs Sign in | Join | Help

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

 

 

Published Wednesday, November 15, 2006 10:43 AM by Calvin_Hsia
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Here's an infinite loop that will hang your machine

Wednesday, November 15, 2006 2:17 PM by Magnussen

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

# re: Here's an infinite loop that will hang your machine

Thursday, November 16, 2006 8:35 AM by Fgarzonhz

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.

# re: making a Chess program

Friday, November 17, 2006 5:27 AM by SparkyMarkyy

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

# re: Here's an infinite loop that will hang your machine

Wednesday, November 29, 2006 9:42 AM by Tod Mckenna

Thanks Calvin,

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

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker