Note: I no longer maintain or monitor this site
4 Jun 2008
A memory overwrite bug has been identified in the TDropFileSource and TDropFileTarget components of the Drag and Drop Component Suite. The bug only manifests itself when support for Unicode filenames is enabled - even if Unicode filenames aren’t used explicitly. Unicode filenames are enabled with Delphi 2006 and later.
The memory overwrite is caused by an incorrect cast in the constructor of the TFileDataFormat class. TFileDataFormat is used internally by components that support drag or drop of files, namely the TDropFileSource, TDropFileTarget, TDropComboTarget and TDropContextMenu components.
The offending code casts a TWideStringList object to a TStringList and sets a property that only exists on the TStringList class:
constructor TFileDataFormat.Create(AOwner: TDragDropComponent); begin inherited Create(AOwner); FFiles := TWideStringList.Create; TStringList(FFiles).OnChanging := DoOnChanging; end;
Since the relative offset of the TStringList.OnChanging property is beyond the size of a TWideStringList object, the result is that random memory is being overwritten.
The bug causes a memory overwrite and the exact symptoms will depend on the current memory layout. Common symptoms are Out of Memory, Access Violation and Stack Overflow errors. The error will most like occur when the components are being constructed. For example when a form, that contains one of the affected components, is created.
If the application is compiled with FastMM in debug mode, FastMM should be able to detect the memory overwrite.
To avoid the bug, support for Unicode filenames must be disabled. This is best done by disabling or deleting the following line in the DragDrop.inc include file:
{$define DD_WIDESTRINGLIST}The problem has already been fixed in the version 5 branch and a new snapshot will be posted as soon as possible.
For version 4.2 the fix is available as a hotfix. The fix will likely be rolled into a future version 4 release if time permits.
Note: This download only applies to the Drag and Drop Component Suite version 4.2.
| Download: | The Drag and Drop Component Suite - Hotfix 4.2.20080604 |
|---|---|
| Version: | 4.2.20080604 |
| Updated: | 4 June, 2008 |
| Size: | 5.08 KB |
| Notes: | Hotfix for the Drag and Drop Component Suite version 4.2 Fixes a memory overwrite bug in TDropFileSource, TDropFileTarget a.o. |
| Downloads: | 5,265 |
DropDropFile.pas file.DropDropFile.pas into the Drag and Drop Component Suite source folder.
Comments »