--- libmikmod-3.1.11.old/playercode/mloader.c +++ libmikmod-3.1.11/playercode/mloader.c @@ -80,6 +80,35 @@ { MLOADER *cruise=firstloader; +//-------------------------------------------------------------------- +// Experimental bug fix. + +// This code is an attempt to prevent an infinite loop. It tries to +// prevent redundant loader registration. Explanation: If a given +// loader is registered two or more times, this leads to the creation +// of a circular linked list. There's a loop at another level that'll +// traverse the circular list forever. + +// Note: This fix is a kludge. The problem should be addressed at a +// higher level. + +#define MAXREGLOADERS 128 + + static MLOADER *xloaders [MAXREGLOADERS]; + static int numxloaders = 0; + int ii; + + if (numxloaders >= MAXREGLOADERS) return; + + for (ii = 0; ii < numxloaders; ii++) + { + if (xloaders [ii] == ldr) return; + } + + xloaders [numxloaders++] = ldr; + +//-------------------------------------------------------------------- + if(cruise) { while(cruise->next) cruise = cruise->next; cruise->next=ldr;