RobLoach / node-raylib

Node.js bindings for Raylib
https://robloach.github.io/node-raylib/
Other
245 stars 20 forks source link

Segfault on LoadModelAnimations #164

Open konsumer opened 1 year ago

konsumer commented 1 year ago

jardeltorres reported on raylib discord, so I followed up.

The code works fine if the animation is commented out, but segfaults if not. Additionally, I get TypeError: r.SetMaterialTexture is not a function

I forked their repro here

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1)
    frame #0: 0x0000000104ddcd61 node-raylib.node`LoadModelAnimations + 177
node-raylib.node`LoadModelAnimations:
->  0x104ddcd61 <+177>: movl   %eax, (%r15)
    0x104ddcd64 <+180>: movl   0x54(%r13), %eax
    0x104ddcd68 <+184>: shlq   $0x2, %rax
    0x104ddcd6c <+188>: leaq   (%rax,%rax,4), %rdi
Target 0: (node) stopped.
konsumer commented 1 year ago

I also tested C raylib 4.2 with this (with the animation stuff uncommented) and it worked ok (hold space to animate.)

https://user-images.githubusercontent.com/83857/203748013-997c5831-e412-49f1-b7af-cfd8604bef2c.mov

I compiled with

gcc $(pkg-config --cflags --libs raylib) main.c -o tester

c_test.zip

konsumer commented 1 year ago

I think it might be passing a value when it expects a pointer, but I'm not totally sure. (address=0x1 in error, and I happen to be setting the animation-count to 1, in a param that is a pointer, not a value. If I set it to 66 I get that address: 0x42.)