Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SERIOUS BUG: you put it in your mind
Message
De
01/09/2004 11:59:08
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
SERIOUS BUG: you put it in your mind
Divers
Thread ID:
00938430
Message ID:
00938430
Vues:
69
VFP version: 6SP5,7SP1,8SP1,9Beta

Preface:

When VFP VM execute a line like:
StringVariable = StringVariable + AnotherString

it uses a optimized concat routine:
if in the heap,
after the value of StringVariable, exists suffiente space for AnotherString, then it copy AnotherString and updates the length in StringVariable.

The VFP VM parser have a bug,
and under particular conditions,
it confuses a object's property name with that one of the variable one,
and,
it completely mistakes in copying the concatenate string.

That is a probable example where this can happen:
CLEAR
SET MEMOWIDTH TO 150
CREATE CURSOR myCursor ( myField M)
INSERT INTO myCursor VALUES (REPLICATE('?',101))
SCATTER MEMO NAME myRecord
INSERT INTO myCursor VALUES (PADR('My name is Fabio',101,'-'))
SCATTER MEMO MEMVAR
myRecord.myField = m.myField +'I add this'
? 'Property'
? '*********************************'
? 'Expected  =', myCursor.myField +'I add this'	AT 20
? 'Effective =', myRecord.myField		AT 20
?
?
? 'Variable'
? '*********************************'
? 'Expected  =', myCursor.myField 	AT 20
? 'Effective =', m.myField 		AT 20
This is a repro code with comments:
* YOU CAN CHANGE THESE CONSTANTS
#define PROPERTYNAME 	someName
#define SUFFIXSTRING	null

CLEAR

oSome=CREATEOBJECT("Empty")
WITH m.oSome
	ADDPROPERTY(m.oSome,[someName],NULL)
	FOR N=1 TO 50
		
		* Set the property to some variant value
		randomSet = RAND()
		DO CASE
			CASE m.randomSet < 0.2						&& A NULL
				.propertyName = .NULL.
			CASE m.randomSet < 0.3						&& A LOGICAL
				.propertyName = RAND()<0.5
			CASE m.randomSet < 0.5						&& A NUMBER
				.propertyName = RAND()
			CASE m.randomSet < 0.6						&& A CURRENCY
				.propertyName = NTOM(RAND()*1000000)
			CASE m.randomSet < 0.7						&& A DATETIME
				.propertyName = DATETIME()
			OTHERWISE
				.propertyName = REPLICATE(CHR(RAND()*256),RAND()*10)
		ENDCASE
		* save it
		propertyPush  = .propertyName

		* Now: build a variable WITH THESE CONDITIONS:
		* - the variable's name is equal to the property's name
		* - fill this variable with a string
		
		propertyName = REPLICATE(CHR(RAND()*256),RAND()*200)
		
		* Now, copy the variable into the property, but add a suffix string ( it can to be empty or null ),
		* with this copy command:
		* --------------------
		* <someobjectreference>.<propertyName> = !m.!<propertyName> !+! SUFFIXSTRING
		* --------------------
		* IF LEN(m.propertyName) IS UPPER TO 100,
		* THEN THE COPY HAVE NOT EFFECT, AND THE PROPERTY VALUE STILL UNCHANGED !
		* IF the added string have LEN(SUFFIXSTRING) upper to zero, VFP put the result value into the source variable !
		* This is correlate with the VFP's "Variable string add optimization alghoritm"

		* !m.! and !+! they are important for the apparition of the bug
		
		* ######### BUG LINE #################
		.propertyName = m.propertyName + SUFFIXSTRING
		* ######### BUG LINE #################
		
		********** with these commands the bug it is not appear
*		<someobjectreference>.propertyName = m.propertyName
*		<someobjectreference>.propertyName = propertyName + SUFFIXSTRING
*		<someobjectreference>.propertyName = '' + m.propertyName + SUFFIXSTRING
*		STORE 	m.propertyName + SUFFIXSTRING TO this.propertyName

		IF VARTYPE(.propertyName,.T.)==VARTYPE(m.propertyPush,.T.) AND .propertyName == m.propertyPush
			? 'property is unchanged',' type :', VARTYPE (.propertyName),' variable lenght :',LEN(m.propertyName)
			?? ' variable is changed to ',m.propertyName
		ENDIF
	NEXT
ENDWITH
? ">>>>>>>>>>  Expected this text line to be printed, only"
Notes:

It is from some weeks that i do not shipment bugs.

Naturally, during this time I have found many other bugs and issues in VFP9Beta; some are serious why they regard SQL SELECT that they generate mistakes results.
But, for me this demands time, and if I do not see resolved the bugs or issues that to more they interest me, I do not see the reason to continue in this way.

From now, without news, this is the last bug that I will send.

I will send to all the accumulated bugs after to have it tries them in the VFP9 final release.

Sorry.
Fabio
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform