Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of bounds read in sysex commands #190

Closed
Ghabry opened this issue Mar 26, 2018 · 4 comments
Closed

Out of bounds read in sysex commands #190

Ghabry opened this issue Mar 26, 2018 · 4 comments

Comments

@Ghabry
Copy link
Contributor

Ghabry commented Mar 26, 2018

Not exploitable, useless out of bounds read behind the sysex_store array by up to 8 bytes.

Found by ASAN while playing the following midi file:
viprpgsz1231.zip

The sysex message is "7f 7f 4 1 0 64 f7" (size = 7).

THe problem is here:

wildmidi/src/internal_midi.c

Lines 2420 to 2426 in 7b87c60

if (memcmp(gm_reset, sysex_store, 5) == 0) {
/* GM Reset */
midi_setup_sysex_gm_reset(mdi);
} else if (memcmp(yamaha_reset,sysex_store,8) == 0) {
/* Yamaha Reset */
midi_setup_sysex_yamaha_reset(mdi);
}

Because sysex store has only a size of 7 the memcmp with 8 reads out of bounds.
Potential fix: Check for sysex_len >= 5 (1st if) and sysex_len >= 8 (2nd if).

RPG Maker games are really great for collecting bad files, already my third report :D

@sezero
Copy link
Contributor

sezero commented Mar 26, 2018

Applied 15e59fa to fix this. Interestingly valgrind does not complain, but ASAN does.
The wildmidi-0.3 branch is not affected.

Thanks.

@sezero sezero closed this as completed Mar 26, 2018
@psi29a
Copy link
Member

psi29a commented Mar 27, 2018

Do we have enough for a 0.4.3? :)

@sezero
Copy link
Contributor

sezero commented Mar 27, 2018

Do we have enough for a 0.4.3? :)

There's still bug #189 but those glitches were always there. i.e. they are no regressions.
You decide?

@sezero
Copy link
Contributor

sezero commented Mar 27, 2018

And there are also bugs #176, #185 and #186 still need addressing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants