You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2018/02/02 13:22:17 UTC
[2/2] thrift git commit: THRIFT-4485 Possible invalid ptr AV with
overlapped read/write on pipes Client: Delphi Patch: Jens Geyer
THRIFT-4485 Possible invalid ptr AV with overlapped read/write on pipes
Client: Delphi
Patch: Jens Geyer
This closes #1489
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/00645162
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/00645162
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/00645162
Branch: refs/heads/master
Commit: 00645162ba1e73ea4fd6e7a47cecf910a29b3281
Parents: 5089b0a
Author: Jens Geyer <je...@apache.org>
Authored: Thu Feb 1 23:38:10 2018 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Feb 2 14:21:18 2018 +0100
----------------------------------------------------------------------
lib/delphi/src/Thrift.Transport.Pipes.pas | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/00645162/lib/delphi/src/Thrift.Transport.Pipes.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Transport.Pipes.pas b/lib/delphi/src/Thrift.Transport.Pipes.pas
index fe96d72..77a343b 100644
--- a/lib/delphi/src/Thrift.Transport.Pipes.pas
+++ b/lib/delphi/src/Thrift.Transport.Pipes.pas
@@ -373,8 +373,10 @@ begin
ERROR_IO_PENDING : begin
dwWait := overlapped.WaitFor(FTimeout);
- if (dwWait = WAIT_TIMEOUT)
- then raise TTransportExceptionTimedOut.Create('Pipe write timed out');
+ if (dwWait = WAIT_TIMEOUT) then begin
+ CancelIo( FPipe); // prevents possible AV on invalid overlapped ptr
+ raise TTransportExceptionTimedOut.Create('Pipe write timed out');
+ end;
if (dwWait <> WAIT_OBJECT_0)
or not GetOverlappedResult( FPipe, overlapped.Overlapped, cbWritten, TRUE)
@@ -473,8 +475,10 @@ begin
ERROR_IO_PENDING : begin
dwWait := overlapped.WaitFor(FTimeout);
- if (dwWait = WAIT_TIMEOUT)
- then raise TTransportExceptionTimedOut.Create('Pipe read timed out');
+ if (dwWait = WAIT_TIMEOUT) then begin
+ CancelIo( FPipe); // prevents possible AV on invalid overlapped ptr
+ raise TTransportExceptionTimedOut.Create('Pipe read timed out');
+ end;
if (dwWait <> WAIT_OBJECT_0)
or not GetOverlappedResult( FPipe, overlapped.Overlapped, cbRead, TRUE)
@@ -876,8 +880,10 @@ begin
CreateNamedPipe;
while not FConnected do begin
- if QueryStopServer
- then Abort;
+ if QueryStopServer then begin
+ InternalClose;
+ Abort;
+ end;
if Assigned(fnAccepting)
then fnAccepting();