# HG changeset patch # User Matti Hamalainen # Date 1425770109 -7200 # Node ID 47d8e5e0e592c38db9020fd0861a8b2c0e44594f # Parent a4816eb6855802496b1be3fad149ce93a1418dd0 Add extra sanity checking to 16-bit sample instruments in XM loader. diff -r a4816eb68558 -r 47d8e5e0e592 minijss/jloadxm.c --- a/minijss/jloadxm.c Sat Mar 07 21:24:17 2015 +0200 +++ b/minijss/jloadxm.c Sun Mar 08 01:15:09 2015 +0200 @@ -579,6 +579,10 @@ inst->size = xmS.size / sizeof(Uint16); inst->loopS = xmS.loopS / sizeof(Uint16); inst->loopE = (xmS.loopS + xmS.loopL) / sizeof(Uint16); + if ((xmS.size & 1) || (xmS.loopS & 1) || (xmS.loopL & 1)) + JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA, + "Samp #%d/%d: size=%d, loopS=%d or loopL=%d not divisible by 2 for 16-bit sample.\n", + neinst, nsample, xmS.size, xmS.loopS, xmS.loopL); } else {