-
Notifications
You must be signed in to change notification settings - Fork 43
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
segfault opening pat #207
Comments
Woooo... thanks! |
Hm, timidity (libtimidity) had no problems loading that pat. |
the code in that function looks really bogus, i suspect it was never tested. 2 different ways to calculate patch length, and later on there are 2 loops doing stuff until datapos != endpos, without resetting datapos after the first loop. |
If I apply the following patch the function succeeds:
The issue is gus_sample->loop_start is 0, and we set read_end as The if condition for the 3rd loop was wrong too: After correcting Other 8 bit 'ping pong' functions would need patching, too. Comments? |
Here is my simple test case, to directly test _WM_load_gus_pat():
Obviously, you need to link to a static debug build of the library. |
The gus patch file in question HELICPTR.PAT is ProPatches Lite: |
I only got an emoji reaction, huh. Note that my patch only prevents the segfault, it doesn't have to sound correct at runtime |
i can't really help there, i stumbled across this issue entirely accidentally. iirc i wanted to test how gravis ultrasound sounds, downloaded some patches and some midi library advertising to support them, and the first thing i tested resulted in the segfault. so i have actually never successfully played this stuff, and have no idea whether it will sound "right" or not. |
Fixes the segmentation fault reported in bug #207.
took me about an hour to figure out what i did 1.5 years ago but here goes [mirrors]
http://web.archive.org/web/20170419131940/http://www.thierryb.net/site/IMG/zip/ProPatchesLite1.61.zip
http://www.thierryb.net/site/IMG/zip/ProPatchesLite1.61.zip
[vars]
filesize=6309158
sha512=5cf3e5bd1d0c6d3b05d69f8178e6b5e87b6fbf3fd0f87d6b25b0f4f07f49d74f4f132f0767202d186f907690ab7cd7368d5aca7a99f52c7351f4a7209542ceb0
tardir=.
pkgver=1
[build]
cat << 'EOF' > printsec.awk
#!/bin/awk -f
# use: $0 <file> <section>
# prints section of file
BEGIN {
if (ARGC!=3) {
print "error: require filename and sectionname" > "/dev/stderr"
exit 1
}
print_sec(ARGV[1], ARGV[2])
exit 0
}
function print_sec(file, sec, r, insect) {
insect=0
while ((r = getline < file) == 1) {
if (insect && /^\[.*\]$/) break
if ($0 == "[" sec "]") {
insect=1
continue
}
if(insect) {
if(/^\s*$/) continue
print $0
}
}
if (r == -1) {
print "unable to read from " file > "/dev/stderr"
exit 1
}
close(file)
}
EOF
chmod +x printsec.awk
unzip ProPatchesLite1.60/pplt_160.zip
unzip Update\ 160to161/pplt161u.zip
for i in ORCDRUM 808DRUM 909DRUM PWRDRUM BRSHDRUM JAZZDRUM ; do
mv pplt_160/$i/* pplt_160/
done
dos2unix pplt161u/ULTRASND.INI
ini() {
bankname="$1"
gusbank="$2"
startno="$3"
endno="$4"
echo "$bankname"
./printsec.awk pplt161u/ULTRASND.INI "$gusbank" > tmp
for n in `seq $startno $endno` ; do
fn=$(cat tmp | grep "^$n=" | cut -d '=' -f 2 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ)
printf " %03d %s.PAT\n" $n "$fn"
done
}
printit() {
ini "bank 0" "Melodic Bank 0" 0 127
ini "drumset 0" "Drum Patches" 27 87
ini "drumset 1" "Drum Bank 9" 27 87
ini "drumset 2" "Drum Bank 17" 27 87
ini "drumset 3" "Drum Bank 25" 27 87
ini "drumset 4" "Drum Bank 26" 27 87
ini "drumset 5" "Drum Bank 33" 27 87
ini "drumset 6" "Drum Bank 41" 27 87
ini "drumset 7" "Drum Bank 49" 27 87
ini "drumset 8" "Drum Bank 0" 27 87
}
printit > propatches.cfg
dest="$butch_install_dir""$butch_prefix"
install -Dm 644 propatches.cfg "$dest"/etc/propatches/propatches.cfg
for i in pplt_160/*.PAT ; do
install -Dm 644 "$i" "$dest"/share/midi/propatches/"$(basename "$i")"
done create /etc/wildmidi/wildmifi.cfg
save this file https://0x0.st/idwY.mid as test.mid run your patch from #219 fixes the segfault, music plays and i can't hear anything odd. EDIT at around 2:38 in the file, something that sounds like a helicopter can be heard. |
Thanks! Saving the test midi here, so that it doesn't get lost. |
Fixes the segmentation fault reported in bug #207.
Fixed by 56f0b5c |
Fixes the segmentation fault reported in bug #207.
Fix applied to wildmidi-0.3 branch too: |
sorry for the potentially stupid and offtopic question, but how can i configure wildmidi.cfg to use the sf2 file here ? https://github.com/Mindwerks/opl3-soundfont |
You can not. No soundfont support yet. |
You can use unsf which converts sf to pat |
https://0x0.st/zHEJ.PAT
The text was updated successfully, but these errors were encountered: