Skip to content

Memory access out of bounds in spine 4.2 #19028

@Arenooo

Description

@Arenooo

Cocos Creator version

3.8.7

System information

Windows 11

Issue description

Memory access out of bounds error in spine 4.2 when setting complete listener in onLoad() with 0 frame animation playing by default and accessing trackEntry.animation.name in listener callback

Relevant error log output

RuntimeError: memory access out of bounds
at null. (wasm://wasm/0010675a:1:25266)
at Ha.name (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\native\external\emscripten\spine\4.2\spine.wasm.js:52:285)
at TrackEntryListeners.complete (hidden)
at Function.emitListener (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:58266:26)
at vb (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\native\external\emscripten\spine\4.2\spine.wasm.js:38:280)
at null. (wasm://wasm/0010675a:1:146685)
at null. (wasm://wasm/0010675a:1:202289)
at null. (wasm://wasm/0010675a:1:29021)
at Ha.eval [as updateAnimation] (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\native\external\emscripten\spine\4.2\spine.wasm.js:31:49)
at Skeleton.updateAnimation (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:59572:28)
at eval (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:58179:22)
at Set.forEach ()
at SkeletonSystem.postUpdate (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:58178:27)
at Director.tick (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:88695:34)
at Game._updateCallback (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:89756:22)
at updateCallback (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:85737:20)
at sentryWrapped (C:\ProgramData\cocos\editors\Creator\3.8.7\resources\app.asar\node_modules@sentry\browser\src\helpers.ts:116:17)

Steps to reproduce

Steps to reproduce:

1 - create a prefab with sp.Skeleton component attached
2 - set a 0 frame animation on the skeleton component on the prefab to play automatically when instantiated
3 - attach a script that will set a listener via skeleton.setCompleteListener in onLoad() function and access the trackEntry.animation.name property
3 - instantiate the prefab and set parent to add to scene
4 - observe the error

onLoad(): void {
        this.skeleton.setCompleteListener((data) => {
            switch (data.animation.name) { // will cause the error
                case 'impact':
                    this.setIdle();
                    break;
                case 'match':
                    this._matchResolve();
                    this.setIdle();
                    break;
            }
        });
    }
Image Image Image

Minimal reproduction project

No response

Metadata

Metadata

Assignees

Labels

BugNeeds TriageNeeds to be assigned by the team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions