Fix SignCheck EndOfStreamException on RPM symlink entries#16718
Merged
ViktorHofer merged 2 commits intomainfrom Apr 14, 2026
Merged
Fix SignCheck EndOfStreamException on RPM symlink entries#16718ViktorHofer merged 2 commits intomainfrom
ViktorHofer merged 2 commits intomainfrom
Conversation
RpmVerifier.ReadArchiveEntries yielded all CPIO entries including symlinks. In CPIO format, symlink entries contain just the target path string as data (e.g. '../../shared/foo.dll', ~30 bytes), not actual file content. These got extracted to disk as tiny files that then failed PE header parsing with EndOfStreamException. The .NET SDK RPMs contain thousands of symlinked .dll files, causing massive error volumes. Root cause fix: - Filter CPIO entries to regular files only using the entry mode field - Remove unused temp file creation in ReadArchiveEntries Defense-in-depth: - Validate file size >= 64 bytes in IMAGE_DOS_HEADER.Read before reading - Catch PE parsing exceptions gracefully in PortableExecutableVerifier Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The existing catch in ArchiveVerifier.VerifyContent (from #16595) already handles exceptions and logs the full exception details. Adding another catch here would eat diagnostic info and mask future issues. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
steveisok
approved these changes
Apr 14, 2026
This was referenced Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
\RpmVerifier.ReadArchiveEntries\ yielded all CPIO entries from RPM payloads—including symlinks. In CPIO format, symlink entries contain just the target path string as data (e.g. ../../shared/foo.dll, ~30 bytes), not actual file content. These got extracted to disk as tiny text files that then failed PE header parsing with \EndOfStreamException, producing thousands of noisy errors like:
\
Outcome="Unsigned" Error="Verification error: System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
at System.IO.BinaryReader.ReadUInt32()
at Microsoft.SignCheck.Interop.PortableExecutable.IMAGE_DOS_HEADER.Read(String path)
...
\\
The .NET SDK RPMs contain thousands of symlinked .dll\ files, explaining the massive error volume.
Fix
Root cause (\RpmVerifier.cs):
Defense-in-depth (\ImageDosHeader.cs):