forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return the true size for ArrayBuffers
Summary: X-link: facebook/react-native#39084 The current behaviour of `jsi::ArrayBuffer::size` with Hermes is to return the value of the `byteLength` property. While this is superficially more consistent with the behaviour for `Array`, which reads the length property, it is a problem in practice since the `byteLength` property is easily overridden in JS, making it unsafe to use when indexing into the backing storage. While this is a behaviour change, it should be fine because: 1. This is already the behaviour with JSC (the newly added test also runs against the JSC implementation) and also seems to be the behaviour of Microsoft's [V8 implementation](https://github.com/microsoft/v8-jsi/blob/db1ca30d6e5d39ee3a88a9f81b258c3825735917/src/V8JsiRuntime.cpp#L1239C48-L1239C58). 2. The current behaviour is counterintuitive and likely to lead to bugs. Changelog: [Internal] Reviewed By: tmikov Differential Revision: D48226661 fbshipit-source-id: 043d60deeb9dc189705594415f4f262f7de1095a
- Loading branch information
1 parent
9e5003b
commit 5d92a92
Showing
3 changed files
with
18 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters