# HG changeset patch # User Matti Hamalainen # Date 1425627913 -7200 # Node ID 30c2dbf05841ec44e571c37f1f6061160f3b46ce # Parent 66c79bae87045d9869262fd638fbd7d96f6c5e74 Add a sanity check for JSSMOD header values. diff -r 66c79bae8704 -r 30c2dbf05841 minijss/jloadjss.c --- a/minijss/jloadjss.c Thu Mar 05 23:14:15 2015 +0200 +++ b/minijss/jloadjss.c Fri Mar 06 09:45:13 2015 +0200 @@ -327,6 +327,18 @@ if (probe) return DMERR_OK; + // Check some of the things for sanity + if (jssH.nchannels > jsetMaxChannels || + jssH.nchannels == 0 || + jssH.norders > jsetMaxOrders || + jssH.npatterns > jsetMaxPatterns || + jssH.nextInstruments > jsetMaxInstruments || + jssH.ninstruments > jsetMaxInstruments) + { + JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, + "Invalid values in JSSMOD header.\n"); + } + // Allocate the module module = jssAllocateModule(); if (module == NULL)