libgme/game-music-emu

Buffer over-read in Gb_Apu::reset

Closed this issue · 2 comments

Original report by James Burton (Bitbucket: jrb, GitHub: jrb).


Line 126:
memcpy( wave.wave, initial_wave, sizeof wave.wave );

sizeof wave.wave is 32 (line 70 of Gb_Oscs.h) but initial_wave is only 16 bytes long.

Original comment by Michael Pyne (Bitbucket: mpyne, GitHub: mpyne).


gb: Fix read from uninit memory initializing wavetable.

Reported by James Burton, the initial_wave preset buffer is actually
smaller than the destination so we used the wrong sizeof. I'm somewhat
surprised the compiler didn't catch it here since it knows both sizes.

Fixes issue #5.

Original comment by Michael Pyne (Bitbucket: mpyne, GitHub: mpyne).


Issue #7 was marked as a duplicate of this issue.