electronoora / komposter

Modular virtual analog software synthesizer and sequencer for 4KB and 64KB intros
http://komposter.haxor.fi/
GNU General Public License v2.0
186 stars 11 forks source link

malloc corruption #79

Closed KammutierSpule closed 6 years ago

KammutierSpule commented 6 years ago

'/usr/local/share/komposter' not found, trying relative path Resource path is resources/

Error in `/home/kammutierspule/Downloads/Demoscene/komposter/komposter': malloc(): memory corruption: 0x00000000009d9250

on line glBindTexture(GL_TEXTURE_2D, font_texture[f][c]); f = 0 c = 33

electronoora commented 6 years ago

Problems similar to this have occurred earlier, and always seemed to have the root cause in dotfile.c and each time I was sure that the issue had been fixed. However, I don't currently have a Linux (I'm assuming you're running on Linux) box with xserver installed so cannot debug this right now.

Please create the file /home/kammutierspule/.komposter with the following two lines and then try to run the komposter binary again:

synthFileDir=/home/kammutierspule/Downloads/Demoscene/komposter/examples/synths songFileDir=/home/kammutierspule/Downloads/Demoscene/komposter/examples/songs

If this helps, I'll know where to look for the problem - again. :)

KammutierSpule commented 6 years ago

Yes I am testing on a Linux Mint machine. There is an issue in dotfile.c s=strchr(t, '\n'); s[0]='\0'; as it is not checking for EOF, so I need to force a \n

Fixing that, there still the same malloc issue with glBindTexture line.

electronoora commented 6 years ago

Valgrind throws a lot of warnings in GLUT, but this caught my eye:

==2304== Invalid write of size 8
==2304==    at 0x40B9F0: font_init (font.c:130)
==2304==    by 0x402F3A: main (main.c:411)
==2304==  Address 0x9535658 is 0 bytes after a block of size 8 alloc'd
==2304==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2304==    by 0x40B98D: font_init (font.c:125)
==2304==    by 0x402F3A: main (main.c:411)
electronoora commented 6 years ago

Ok, looks like when I originally wrote the code on a 32-bit platform, I made the assumption that sizeof(long) == 4.