-
Notifications
You must be signed in to change notification settings - Fork 16
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
Investigate LZF Compressor memory access issues #6
Comments
Hey! I'm pretty sure the crash in question happens when you try to decompress invalid data (e.g. uncompressed data as input, or input that got corrupted during transport despite having a valid checksum). This causes a StackOverflowException to be thrown and crashes Unity (possibly because of the unsafe context?) since the Decompress function stackallocs more memory upon failure and tries again until it succeeds. The solution (on my end at least) was to add a Some ideas for workarounds:
I don't currently use this library but you can test this with the following change to the Decompress function:
I don't definitively know if this is the only thing that would cause such a crash of course, but in my case it seemed to be. If the crash goes away and you start getting -1 as the return value, you can then log the offending bits of data to see what the underlying error is. I'd send a proper fix but I'm not sure how one could decide a reasonable upper bound outside my own use case. Hope this is of some help anyway. Thank you for your work on the library btw! :) |
As mentioned in #5, there are memory access issues with the LZFCompressor implementation that are causing Unity to crash. This should not be happening on any input.
With #5's merge, it will be disabled by default, but it is key in reducing bandwidth usage and ensuring messages are below max message size limits.
This should be investigated and reenabled once this has been resolved.
The text was updated successfully, but these errors were encountered: