Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Buffer overrun
Message
De
26/10/2011 04:41:08
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Buffer overrun
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01527390
Message ID:
01527390
Vues:
620
This is just to share the experience - the problem is solved, no stars :).

There's a first for everything. Here's what I started getting the other day:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Buffer overrun detected!

Program: Q:\sopstver\db\VFP9\vfp9.exe

A buffer overrun has been detected which has corrupted the program's
internal state.  The program cannot safely continue execution and must
now be terminated.

---------------------------
OK   
---------------------------
This is the first time in 22 years that I've seen Fox cause a buffer overrun. It appeared only on one particular record, on a rich form with a dozen cursors related to this record. Began to chase it with coverage logging - but that was only the starting point, because coverage output is buffered, and I was getting only the last whole buffer... it pointed to the refresh process, and I at least knew which was the last object to refresh properly. Started setting breakpoints - wait window, messagebox() and the like... and then eventually managed to reproduce it in the debugger. The culprit, after a good day's hunt, was setting a label.caption=left(memofield, 255). So here's some code to reproduce this, if anyone is interested. The commented-out line is the fix - uncomment it and comment the next line, and it works: The text in this sample is a mangled excerpt from T&C of UT:
*-- text block begin
text to c noshow 
Depending on the severity & the situation, when one & the Terms & Conditions has been 
violated, & we may try to contact & member & simply proceed with & proper 
procedures & ensure the good running of the site.

We will coordinate & the authorities to trace & member 
that has violated & law with its dealings & us.

We reserve the right & such a situation to divulge & the authorities & personal 
information that we may have about the member in order to facilitate & locating of the member.
endtext
*-- text block end

LOCAL ol as Label
_screen.AddObject("ol", "label")
ol=_screen.OL
ol.visible=.t.
ol.AutoSize=.t.
FOR i=252 to 255
	WAIT wind i
*	ol.Caption=LEFT(CHRTRAN(c, "&", "-"), i)
	ol.Caption=LEFT(c,i)
ENDFOR
ol=null
_screen.RemoveObject("ol")

*My guess is that multiple ampersands on a label captions confuse Windows hotkey system
* (and whatever API Fox calls for that), as the ampersand is considered the Windows equivalent 
* of \<, i.e. prefix for the hotkey.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform