espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.73k stars 741 forks source link

Uint8Array constructor byteOffset is restricted to 2bytes #2439

Closed wagnerf42 closed 7 months ago

wagnerf42 commented 7 months ago

hi,

byteOffset in the Uint8Array constructor stops working when the integer goes over 65536. it just wraps around so surely this offset is coded in C as a 2 bytes integer.

i'm not sure how feasible it would be to switch to a larger integer ?

wagnerf42 commented 7 months ago

thinking again about it, it's not such a big deal, I will be able to get around it using storage.read(). i'm not even sure we did'nt already discuss this actually. so, maybe we could close the issue.

gfwilliams commented 7 months ago

Ok, well, I think this isn't something easily fixable - we only have a certain amount of space in the structure to store an offset.

However it should throw an error, not wrap - i'll see about getting a fix in