How to crash a server with a Variant

Dear All

Here below an agent source code to crash a server or a client

The expected error should be “object variable not set” or “type mismatch” instead of crashing any process.
Indeed, the GetDB() function trigger an error, then the DB() singleton which is a variant isn’t set, and the command line “Set DB = singleton” try to set as output an empty variant.
Finally when the agent call msgbox DB().title, the server/client crash.

Hope a fixpack will be provided soon.

Option Public
Option Declare
%REM
Agent DOO_Crash
Created Jan 29, 2011 by e_bdetar
Description: Agent to cause server crash
%END REM

Sub Initialize()

Call crash()

End Sub

%REM
Function getDB
Description: Return an error
Return : NotesDatabase
%END REM
Function getDB As NotesDatabase
On Error GoTo handleError

Dim rc As NotesDatabase

Error 1000, “test crash”

GoTo handleExit

handleError:
On Error Resume Next

handleExit:
Set getDB = rc
End Function

%REM
Property Get DB
Description: Singleton to retrieve a notesdatabase
%END REM
Static Property Get DB As NotesDatabase
On Error GoTo handleError

Static singleton As Variant

If IsEmpty(singleton) Then
Set singleton = getDB()
End If

GoTo handleExit

handleError:
On Error Resume Next

handleExit:
Set DB = singleton
End Property

%REM
Sub crash
Description: Command used to crash a server or a client
%END REM
Sub Crash()
On Error GoTo handleError

MsgBox DB().Title

GoTo handleExit

handleError:
On Error Resume Next

handleExit:
End Sub

A way to prevent crash is to bypass getDB error handling.

%REM
Function getDB
Description: Return an error
Return : NotesDatabase
%END REM
Function getDB As NotesDatabase
On Error GoTo handleError

Dim rc As NotesDatabase

Error 1000, “test crash”

GoTo handleExit

handleError:
On Error Resume Next
resume handleExit

handleExit:
Set getDB = rc
End Function

But it isn’t a valid solution.

In this case we lose all error handling.

Moreover all functions behavior depends on what is the calling proc.