-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
EXC_BAD_ACCESS lime::PNG::Decode #1894
Comments
The @:noCompletion private function __fromBytes(bytes:Bytes, onload:Image->Void = null):Bool
{
if (bytes == null || bytes.length < 8) // <-- check bytes length
return false;
#if (js && html5) lime/src/lime/graphics/Image.hx Line 1462 in abb92a2
|
It seems to be true. |
JPEG and GIF can have smaller byte lengths for their signatures. If we're specifically going to check that it's larger than 8 bytes for PNG, it should probably be somewhere around here: https://github.com/openfl/lime/blob/a03c0c3/project/src/graphics/format/PNG.cpp#L94-L95 |
The problem here is that Bytes.b is null. This could be a problem for jpeg and gif as well. Just checking if bytes is valid could solve the problem. if (bytes == null || bytes.length == 0)
return false; |
I think it makes more sense to throw an exception instead of returning false, doesn't it? |
There is no exception used in the Image class, in fact the throw on line 1479 is remarked, there may be a reason for this. Also, |
I get crash errors for this reason at least once a day.
Lime 8.2.1
The text was updated successfully, but these errors were encountered: