blitz-research / monkey

Blitz Research Monkey Source
225 stars 59 forks source link

Bugfix: Samsung Galaxy S3 - Android Browser - Databuffer Boundary Bugfix #93

Open JochenHeizmann opened 7 years ago

JochenHeizmann commented 7 years ago

The Android Browser in my Samsung Galaxy S3 (Android 4.4.2) does have a problem that I haven't encountered in other Browsers:

Creating a buffer view with an buffer that has a size that isn't a multiple of the base type creates an Exception:

ArrayBuffer length minus the byteOffset is not a multiple of the element size

This happened to me in a game where I'm loading a Binary File. Of course it is possible that the size of this Binary File isn't a multiple of 4.

Now when Monkey tries to load in the File into a DataBuffer object the above-mentioned Exception is thrown.

I've created a workaround in this pull request because I weren't able to come up with a cleaner solution:

If the length of the buffer isn't a multiple of 4, I copy/resize the buffer to be a multiple of 4 in length.

But I keep the original length property so that the seeking logic remains the same.