Buffer over-read in Gb_Apu::reset

Issue #5 resolved
James Burton created an issue

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.

Comments (2)

  1. Michael Pyne repo owner

    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.

    → <<cset 0f6ddc87f9ad>>

  2. Log in to comment