فهرست منبع

* protect against empty strings inside the SetThreadDebugNameA and -U functions

git-svn-id: trunk@45237 -
svenbarth 5 سال پیش
والد
کامیت
73026618c8
2فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 2 0
      rtl/unix/cthreads.pp
  2. 6 0
      rtl/win/systhrd.inc

+ 2 - 0
rtl/unix/cthreads.pp

@@ -494,6 +494,8 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
 {$endif}
     begin
 {$if defined(Linux) or defined(Android)}
+      if ThreadName = '' then
+        Exit;
   {$ifdef dynpthreads}
       if Assigned(pthread_setname_np) then
   {$endif dynpthreads}

+ 6 - 0
rtl/win/systhrd.inc

@@ -400,6 +400,9 @@ var
     procedure SysSetThreadDebugNameA(threadHandle: TThreadID; const ThreadName: AnsiString);
     begin
 {$ifndef WINCE}
+      if ThreadName = '' then
+        Exit;
+
       if WinIsDebuggerPresent then
       begin
         RaiseMSVCExceptionMethod(threadHandle, ThreadName);
@@ -417,6 +420,9 @@ var
     procedure SysSetThreadDebugNameU(threadHandle: TThreadID; const ThreadName: UnicodeString);
     begin
 {$ifndef WINCE}
+      if ThreadName = '' then
+        Exit;
+
       if WinIsDebuggerPresent then
       begin
         RaiseMSVCExceptionMethod(threadHandle, AnsiString(ThreadName));