facebook / facebook/hermes

Property storage exceeds 196607 properties when creating a large sparse array

Open
#1,070 12 comments 7 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

## Bug Description

I've used `@react-three/fiber` and tried to load GLTF model with `useGLTF` hook (it uses `expo-asset` which uses `blueimp-md5` which throws with hermes).

Error log:
```
Possible Unhandled Promise Rejection (id: 0):
RangeError: Property storage exceeds 196607 properties
RangeError: Property storage exceeds 196607 properties
at rstr2binl (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1308:19)
at rstrMD5 (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1319:41)
at rawMD5 (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1353:21)
at hexMD5 (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1356:29)
at md5 (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1367:24)
at ?anon_0_ (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:256954:56)
at next (native)
at asyncGeneratorStep (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1456:26)
at _next (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1475:29)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1480:14)
at tryCallTwo (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:61:9)
at doResolve (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:216:25)
at Promise (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:82:14)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1472:25)
at apply (native)
at _downloadAsyncUnmanagedEnv (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:256947:45)
at ?anon_0_ (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:256919:40)
at next (native)
at asyncGeneratorStep (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1456:26)
at _next (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1475:29)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1480:14)
at tryCallTwo (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:61:9)
at doResolve (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:216:25)
at Promise (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:82:14)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1472:25)
at apply (native)
at downloadAsync (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:256912:32)
at ?anon_0_ (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:259334:103)
at next (native)
at asyncGeneratorStep (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1456:26)
at _next (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1475:29)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1480:14)
at tryCallTwo (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:61:9)
at doResolve (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:216:25)
at Promise (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:82:14)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:1472:25)
at apply (native)
at downloadAsync (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:259353:39)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:260924:34)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478024:22)
at tryCallTwo (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:61:9)
at doResolve (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:216:25)
at Promise (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:82:14)
at loadBuffer (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478023:27)
at getDependency (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477961:43)
at loadBufferView (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478033:34)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477957:64)
at _invokeOne (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477915:28)
at getDependency (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477956:43)
at loadAccessor (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478054:53)
at getDependency (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477953:45)
at assignAttributeAccessor (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478868:34)
at addPrimitiveAttributes (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478875:43)
at loadGeometries (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478413:55)
at loadMesh (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478437:43)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477949:52)
at _invokeOne (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477915:28)
at getDependency (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477948:43)
at createNodeMesh (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478652:36)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478707:58)
at _invokeOne (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477915:28)
at _loadNodeShallow (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478706:44)
at loadNode (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478671:50)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477944:52)
at _invokeOne (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477915:28)
at getDependency (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477943:43)
at loadScene (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478780:44)
at getDependency (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477940:42)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478005:40)
at map (native)
at getDependencies (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:478004:46)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:477833:53)
at tryCallOne (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:53:16)
at anonymous (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/5e6w3h5p/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:139:27)
at apply (native)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:28884:26)
at _callTimer (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:28803:17)
at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:28833:17)
at callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:28996:44)
at __callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:4331:46)
at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:4143:45)
at __guard (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:4315:15)
at flushedQueue (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=dev.world.oone.driverapp&modulesOnly=false&runModule=true:4142:21)
```
This is the function:
https://github.com/blueimp/JavaScript-MD5/blob/2c00da944e9f9ecc2348cf9ed26cd3808106aee2/js/md5.js#L257C48-L257C48
It fills array in unfamiliar way, that it not throws with small inputs, but throws with big ones

- [x] I have run `gradle clean` and confirmed this bug does not occur with JSC

Hermes version:
React Native version (if any): 0.71.7
OS version (if any): Android
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): arm64-v8a / x86_64

## Steps To Reproduce

Run this code inside hermes

```js
var output = []
output[(6666145 >> 2) - 1] = undefined
for (i = 0; i < output.length; i += 1) {
output[i] = 0
}
```

## The Expected Behavior
To not recognize array as object and not throw

## The Current Behavior
Trying to use array indices as object keys and throws

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.