libgme / game-music-emu

Blargg's video game music emulation library, which allows audio applications to easily add playback support for the music of many classic video game consoles.
GNU Lesser General Public License v2.1
68 stars 12 forks source link

Buffer over-read in Gb_Apu::reset #7

Closed Wohlstand closed 7 years ago

Wohlstand commented 7 years ago

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.

Wohlstand commented 7 years ago

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.

Wohlstand commented 7 years ago

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


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