Open GoogleCodeExporter opened 8 years ago
I have to admit I was skeptical on this bug, but this morning I've hit.
Same PC configuration as above (Win7 x64 sp1, OHM 0.6.0).
I had 2 FTDI cables and OHM didn't start until I've removed one of them.
Virtual COM ports were inactive.
The crash popup appeared as soon as I removed one of the cables.
Original comment by drsur...@gmail.com
on 13 Jun 2014 at 9:50
[deleted comment]
The issue occurs when:
a) system is 64 bit Windows
b) There is more than one FTDI device where the info.Type is FT_DEVICE_232BM
This occurs during instantiation of a TBalancerGroup
There is a marshaling type mismatch for FT_HANDLE types defined in FTD2XX.cs.
FT_HANDLE is defined as a structure containing private readonly uint handle;
uint handle is a 32 bit entity. A handle type on 64 bit platforms is a 64 bit
entity.
When FT_OPEN() is called the 32 bit reference to handle is written with 64 bits
which overwrites i defined in for (int i = 0; i < numDevices; i++) to 0. This
causes an infinite loop where i < numDevices is always true (not to mention
clobbering other things on the stack).
Changing
[StructLayout(LayoutKind.Sequential)]
internal struct FT_HANDLE {
private readonly uint handle;
}
to
[StructLayout(LayoutKind.Sequential)]
internal struct FT_HANDLE {
private readonly IntPtr handle;
}
solves the problem as IntPtr is always guaranteed to be the proper size for the
current platform.
Original comment by on.gw...@gmail.com
on 12 Mar 2015 at 12:37
Original issue reported on code.google.com by
joanna.b...@gmail.com
on 25 Mar 2014 at 3:29Attachments: