HTML5 (Samsung S3/Android Browser): Databuffer Bug

Monkey Forums/Monkey Bug Reports/HTML5 (Samsung S3/Android Browser): Databuffer Bug

maverick69(Posted 2016) [#1]
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 (https://github.com/blitz-research/monkey/pull/93) 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.

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