-
-
Notifications
You must be signed in to change notification settings - Fork 740
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
EndOfStreamException thrown when using loaddependencies=true #2963
Comments
augustoproiete
added a commit
to augustoproiete-forks/cake-build--cake
that referenced
this issue
Dec 5, 2020
@uglybugger Your analysis was correct and I was able to reproduce the error by creating a Cake add-in that includes a using System.IO;
void Main()
{
var buffer = new byte[365]; // Minimum size for Cake to consider analyzing it
using (var stream = new MemoryStream(buffer))
{
using (var binaryWriter = new BinaryWriter(stream))
{
binaryWriter.Write(new byte[60]);
binaryWriter.Write(5000); // Tell Cake to jump to a position beyond the length of the stream
}
}
Directory.CreateDirectory(@"C:\Temp");
File.WriteAllBytes(@"C:\Temp\InvalidPE.dll", buffer);
} |
augustoproiete
added a commit
to augustoproiete-forks/cake-build--cake
that referenced
this issue
Dec 5, 2020
augustoproiete
added a commit
to augustoproiete-forks/cake-build--cake
that referenced
this issue
Dec 5, 2020
augustoproiete
added a commit
to augustoproiete-forks/cake-build--cake
that referenced
this issue
Dec 5, 2020
augustoproiete
added a commit
to augustoproiete-forks/cake-build--cake
that referenced
this issue
Dec 5, 2020
augustoproiete
added a commit
to augustoproiete-forks/cake-build--cake
that referenced
this issue
Dec 5, 2020
augustoproiete
added a commit
to augustoproiete-forks/cake-build--cake
that referenced
this issue
Dec 5, 2020
Fixed by #2971 |
🎉 This issue has been resolved in version v1.0.0 🎉 The release is available on: Your GitReleaseManager bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What You Are Seeing?
Hi! I'm trying to install an addin using the
loaddependencies=true
parameter:I'm observing an error where Cake scans the dependency graph and attempts to detect if each assembly is a CLR assembly.
I suspect that there's something in the offset reading code in
FileExtensions.IsClrAssembly
which, when presented with a non-CLR .dll is reading at one offset, finding what it thinks is another offset, and attempting to set the stream pointer to somewhere beyond the stream's end.It looks like this line sets the stream position to whatever it's read at the previous location without checking whether that puts things beyond the end of the stream.
This also suggests that there might be other non-CLR DLLs being tested by Cake which happen to have a small number at the first offset read, which are sneaking through the test. I haven't dug too far into it so please take that with a grain or two of salt.
What is Expected?
Cake correctly walks the dependency graph and filters out non-CLR assemblies.
Workaround
This is preventing the use of the
loaddependencies=true
parameter. The best workaround I've found is to include all of the Cake addin's dependencies manually inbuild.cake
as well. There is a long list of dependencies :)What version of Cake are you using?
0.38.5
Are you running on a 32 or 64 bit system?
What environment are you running on? Windows? Linux? Mac?
Are you running on a CI Server? If so, which one?
How Did You Get This To Happen? (Steps to Reproduce)
I just added an addin directive to my Cakefile with
loaddependencies=true
. It worked fine locally and then went 💥 on the build server.Other Cakefiles with other addins seem to work fine so I suspect that it's just the dependencies of this (unfortunately currently internal) addin that cause Cake to throw.
Output logs
Unfortunately sanitising that much of an output log isn't feasible. I've fished out the stack trace (above); hopefully that gives a good pointer to what's going on.
The text was updated successfully, but these errors were encountered: