Guest User

Untitled

a guest
Apr 1st, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. commit f2a80d70e485781c48321fe8ccf7b50d79f63cdc
  2. Author: Rolf Bjarne Kvinge <[email protected]>
  3. Date: Thu Mar 31 14:09:53 2016 +0200
  4.  
  5. [process] Initialize exit code before calling GetExitCodeProcess.
  6.  
  7. GetExitCodeProcess may fail (if getting the exit code of an exited process
  8. we only have the pid for) and not write anything to the *code
  9. parameter.
  10.  
  11. In that case GetExitCodeProcess would return random memory.
  12.  
  13. If that random memory happened to be 0x103 (259), then Process.HasExited
  14. would return false, even though the process had actually exited.
  15.  
  16. Due to the reference import of Process in master, this code is
  17. completely different there, and this bug probably only occurs on
  18. the mono-4.4.0-branch.
  19.  
  20. diff --git a/mono/metadata/process.c b/mono/metadata/process.c
  21. index f662cf6..5794956 100644
  22. --- a/mono/metadata/process.c
  23. +++ b/mono/metadata/process.c
  24. @@ -867,7 +867,7 @@ gint64 ves_icall_System_Diagnostics_Process_StartTime_internal (HANDLE process)
  25.  
  26. gint32 ves_icall_System_Diagnostics_Process_ExitCode_internal (HANDLE process)
  27. {
  28. - DWORD code;
  29. + DWORD code = 0;
  30.  
  31. GetExitCodeProcess (process, &code);
Advertisement
Add Comment
Please, Sign In to add comment