shinyblink / sled

Satanic/Sexy/Stupid/Silly/Shiny LED matrix controller
https://shinyblink.github.io/sled/
ISC License
122 stars 25 forks source link

Segfault with small matrix sizes #31

Closed marenz2569 closed 6 years ago

marenz2569 commented 6 years ago

sled crashes with segfault when using small matrix sizes like 10x10. In this case I used out_sdl2 with scaling factor 1. The version I am using is master as of now. (f558241)

Initializing modules...
    - sinematrix... Done.
    - candyflow... Done.
    - clock... Ignored by request of plugin.

Program received signal SIGSEGV, Segmentation fault.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────[ registers ]────
$rax   : 0x000055555575e3c0  →  0x000000726f727265 ("error"?)
$rbx   : 0x0000000000000002
$rcx   : 0x0000000000000000
$rdx   : 0x00007fffffffdde0  →  0x00007fffffffdec0  →  0x00000000ffffffff
$rsp   : 0x00007fffffffe308  →  0x00005555555573b0  →  <matrix_getx+17> add rsp, 0x8
$rbp   : 0x0000000000000002
$rsi   : 0x0000000000000000
$rdi   : 0x0000000000000002
$rip   : 0x0000000000000000
$r8    : 0x0000000000000005
$r9    : 0x000055555575d5b0  →  0x000000736c6c6162 ("balls"?)
$r10   : 0x0000000000000058
$r11   : 0x000055555555739f  →  <matrix_getx+0> sub rsp, 0x8
$r12   : 0x000055555575d5b0  →  0x000000736c6c6162 ("balls"?)
$r13   : 0x0000000000000001
$r14   : 0x0000000000000000
$r15   : 0x0000000000000000
$cs    : 0x0000000000000033
$ss    : 0x000000000000002b
$ds    : 0x0000000000000000
$es    : 0x0000000000000000
$fs    : 0x0000000000000000
$gs    : 0x0000000000000000
$eflags: [zero carry parity adjust sign trap INTERRUPT direction overflow RESUME virtualx86 identification]
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ stack ]────
0x00007fffffffe308│+0x00: 0x00005555555573b0  →  <matrix_getx+17> add rsp, 0x8   ← $rsp
0x00007fffffffe310│+0x08: 0x0000000000000008
0x00007fffffffe318│+0x10: 0x00007ffff6a5dad7  →  <init+13> mov ebx, eax
0x00007fffffffe320│+0x18: 0x0000000000000002
0x00007fffffffe328│+0x20: 0x0000000000000002
0x00007fffffffe330│+0x28: 0x00007fffffffe3a8  →  0x000000000000000b
0x00007fffffffe338│+0x30: 0x0000555555558f11  →  <modules_init+345> mov r13d, eax
0x00007fffffffe340│+0x38: 0x00000000ffffffff
───────────────────────────────────────────────────────────────────────────────────────────────────────[ code:i386:x86-64 ]────
[!] Cannot disassemble from $PC
────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ threads ]────
[#0] Id 1, Name: "sled", stopped, reason: SIGSEGV
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ trace ]────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
0x0000000000000000 in ?? ()
gef➤  bt
#0  0x0000000000000000 in ?? ()
#1  0x00005555555573b0 in matrix_getx () at src/matrix.c:37
#2  0x00007ffff6a5dad7 in init (moduleno=0x2, argstr=<optimized out>) at src/modules/gfx_balls.c:32
#3  0x0000555555558f11 in modules_init (outmodno=outmodno@entry=0x7fffffffe3a8) at src/modloader.c:179
#4  0x0000555555557070 in sled_main (argc=<optimized out>, argv=<optimized out>) at src/main.c:234
#5  0x00005555555590b9 in main (argc=<optimized out>, argv=<optimized out>) at src/os/os_unix.c:22
marenz2569 commented 6 years ago

This happens every time? (at least that is what I have seen) when a module is ignored as the matrix has a too small size, for that module.

marenz2569 commented 6 years ago

This was a nasty one.

vifino commented 6 years ago

oof. thanks for fixing this, i'll comment on the pr in a sec!