Back

SEC014

Unsafe direct typecast

Object Pascal — Delphi & Free Pascal
Warning
Security

Direct typecasts skip runtime type checking and can cause access violations or data corruption

direct typecasts skip runtime type checking and can cause access violations or data corruption.

Why this severity

direct typecasts skip runtime type checking and can cause access violations or data corruption.


Known false positives

casts on known-safe types verified by an immediately preceding 'is' check.

Remediation example

if Sender is TButton then
  Btn := Sender as TButton;

Reconnecting… Connection lost. Reload