changeset 1254:47d8e5e0e592

Add extra sanity checking to 16-bit sample instruments in XM loader.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 08 Mar 2015 01:15:09 +0200
parents a4816eb68558
children f9bf71071f0b
files minijss/jloadxm.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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
     {