View Issue Details

IDProjectCategoryView StatusLast Update
0038107FPCRTLpublic2020-11-20 21:40
ReporterMartok Assigned ToFlorian  
Status resolvedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038107: SerReadTimeout: invalid passing of parameter in Windows implementation
DescriptionIn rtl-extra's unit serial, the version of SerReadTimeout with a count parameter has the signature
    function SerReadTimeout(Handle: TSerialHandle; var Buffer: array of byte; count, mSec: LongInt): LongInt;

In packages/rtl-extra/src/win/serial.pp:466, the buffer is passed incorrectly as
    ReadFile(Handle, Buffer, count, BytesRead, nil)

This overwrites the address of the dynarray (and some memory after that pointer), not the allocated memory. This should be either Buffer[0] -- or change the interface to not use a dynarray and instead use an untyped parameter as is done for every other Read/Write function (such as the SerReadTimeout overload without a count parameter).
Additional InformationThis is *not* a duplicate of 0034404, which was about the non-standard interface itself.
TagsNo tags attached.
Fixed in Revision47505
Attached Files



2020-11-20 21:40

administrator   ~0127076

Thanks for the hint, resolved.

Issue History

Date Modified Username Field Change
2020-11-20 20:44 Martok New Issue
2020-11-20 21:40 Florian Assigned To => Florian
2020-11-20 21:40 Florian Status new => resolved
2020-11-20 21:40 Florian Resolution open => fixed
2020-11-20 21:40 Florian Fixed in Version => 3.3.1
2020-11-20 21:40 Florian Fixed in Revision => 47505
2020-11-20 21:40 Florian FPCTarget => -
2020-11-20 21:40 Florian Note Added: 0127076