libmid: fix more crashes/overflows
midiogre: fix crashes/overflows