mpxout.w (mpx_cleandir): Fix _findfirst handle truncation on x86_64 #9350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Package
mingw-w64-x86_64-texlive-bin
.When MetaPost calls
mpx_cleandir
to delete temporary auxiliary files (e.g., from running TeX to format a label), it segfaults inRtlEnterCriticalSection
. This doesn't affect the 32-bit binaries shipped by the TexLive project.At line 3872 of "mpxout.w" (see svn://tug.org/texlive/trunk/Build/source/texk/web2c/mplibdir/mpxout.w@58686),
hFile
is declared aslong
. The handle returned by_findfirst
is stored there and truncated. Then it is sign-extended and passed to_findnext
. There is a segfault when it is first dereferenced, which happens inRtlEnterCriticalSection
.Presumably this could be fixed by changing
long
tointptr_t
there, as in this PR, but this is untested, as I haven't managed to rebuild the package here.To reproduce the crash, in a MINGW64 bash shell:
Example output:
(The
rcx
value may be positive or negative, depending on bit 31 of the handle returned by_findfirst
.)