Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think the source of problem is in the Uint8Array (or other types arrays) constructor. It has wrong level of abstraction.

Instead of Uint8Array take an ArrayBuffer and an offset and a length. There should instead be something like ArrayBufferView to take the offset and length. And Uint8Array just new with the view, and uint8Array.buffer just return the view. Nothing like missing the offset or length would happen again.

Besides this, missing a intermediate level in between is also a security issue. It means there isn't a way to pass a partial view to a ArrayBuffer safely to other function. Because typedArray.buffer always give you the full ArrayBuffer.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: