Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden windows_get_shell #5714

Merged
merged 3 commits into from
Nov 13, 2023
Merged

Harden windows_get_shell #5714

merged 3 commits into from
Nov 13, 2023

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Nov 2, 2023

In Windows native containers, the Filename.chop_suffix call in windows_get_shell was occasionally failing. OpamStubs.getProcessAncestry can return empty strings. windows_get_shell now explictly handles the empty string case and .exe is now optionally stripped.

@rjbou
Copy link
Collaborator

rjbou commented Nov 2, 2023

related to #5644 (comment)

@@ -105,6 +105,7 @@ users)
## Internal

## Internal: Windows
* Fix sporadic crash in shell detection (seen in native containers) [#5714 @dra27]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for dev: Missing api changelog

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

dra27 added 3 commits November 7, 2023 15:31
In Windows native containers, the Filename.chop_suffix call in
windows_get_shell was occasionally failing. OpamStubs.getProcessAncestry
can return empty strings. windows_get_shell now explictly handles the
empty string case and .exe is now _optionally_ stripped.
The code for reading new processes would fail to NULL-terminate the list
if new entries were read and the target was not found.
The current pointer would end up pointing to a freed block if realloc
had to move the process list.
@dra27
Copy link
Member Author

dra27 commented Nov 7, 2023

I pushed two commits fixing errors in the C stub for determining the shell, one of which was heinous (the pointer into the array would end up pointing at the old array following realloc)

@kit-ty-kate
Copy link
Member

Thanks!

@kit-ty-kate kit-ty-kate merged commit 05915bc into ocaml:master Nov 13, 2023
28 checks passed
@dra27 dra27 deleted the harden-docker branch November 13, 2023 11:25
@dra27 dra27 mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants