062c8ae
Regardless of whether an input file may be broken, it must not crash
062c8ae
the decoder.
062c8ae
062c8ae
diff -Nur audacious-plugins-fedora-2.2-orig/src/adplug/core/lds.cxx audacious-plugins-fedora-2.2-adplug-lds/src/adplug/core/lds.cxx
062c8ae
--- audacious-plugins-fedora-2.2-orig/src/adplug/core/lds.cxx	2009-11-22 23:49:52.000000000 +0100
062c8ae
+++ audacious-plugins-fedora-2.2-adplug-lds/src/adplug/core/lds.cxx	2010-01-25 19:09:28.000000000 +0100
062c8ae
@@ -665,6 +665,9 @@
062c8ae
 void
062c8ae
 CldsPlayer::playsound (int inst_number, int channel_number, int tunehigh)
062c8ae
 {
062c8ae
+  if (inst_number > numpatch-1) {
062c8ae
+      return;
062c8ae
+  }
062c8ae
   Channel *c = &channel[channel_number];    // current channel
062c8ae
   SoundBank *i = &soundbank[inst_number];   // current instrument
062c8ae
   unsigned int regnum = op_table[channel_number];   // channel's OPL2 register