[Lazarus] Causing bluescreen on windows by move() procedure

Bo Berglund bo.berglund at gmail.com
Sat Feb 26 15:32:32 CET 2011


I have a question regarding the way Lazarus/Fpc programs are running
on windows:

A few days ago I was testing GPS communications to retrieve accurate
time. I had written a small program that connected to the GPS using
the SdpoSerial component.
All was working OK.

Then I decided to check how the time would differ by starting two
instances of my program but due to a shortcircuit in my head I started
a completely *different* program that used a different baudrate and
had different handling of received data. So the program opened the
port at 38200 baud but the GPS sent data at 4800 baud. It also uses
the SdpoSerial component.

SURPRISE:
When I opened the port it took less than 2-3 seconds before I had
bluescreened my Win7 x64 computer!

And to top it off, after Win7 recovered I *repeated* the stupid
mistake and bluescreened again before I realized my mistake.

My question here though is:
How can a user level program do this?
I would have expected an access violation that would have thrown out
the program but not a repeatable bluescreen.

The main difference between the two programs is that the mistakenly
started program uses a not yet ready buffer class where a dynamically
sized byte array is used as a buffer and data are moved using the Move
function.

In all of my programming with Delphi I have never managed to make a
programming error that consistently bluescreens the PC.


-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list