Use bit-test for m-nType.

--Patch from Ozkan Sezer <sezero@users.sf.net>
Note that m_nType should only be set to a single "type". 

Signed-off-by: Konstanty Bialkowski <konstanty@ieee.org>
Use MMD_FLAG_8CHANNEL instead of magic numbers
Prevent usage of 'negative index' patterns in GetPattern.

Note: This function is not usually called using user (file) input.
Reported by Agix & 0verclOk
Sanitise divider to 1

-- 0 causes while loop not to finish
Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
CVE-2013-4233 Fix

Integer overflow in j variable

-- reported by Florian "Agix" Gaultier
CVE-2013-4234 Fix

Heap overflow in abc_MIDI_drum + abc_MIDI_gchord

-- reported by Florian "Agix" Gaultier
Don't load MID if no channels or tracks
Ensure numpats isn't greater than MAX_PATTERNS

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Ensure flags and ->numbits must match

MMCMP_16BIT has up to 16 flags,
MMCMP_8BIT has up to 8 flags
if none of these are OK, then invalid file.
--Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Use strncpy to bound size to output size

m_szNames has 32 bytes (including 0 byte)
--Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Ensure iOrd is within DSM's order size

Base maximum orders for DSM on sizeof(psong->orders), not MAX_ORDERS,
DSM's is slightly smaller than libmodplug's.
--Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Ensure overflow does not occur for MMCMP samples

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Fix check on lastpattern

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Use correct bounds on strncpy function (32 not 36)

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
State purpose of MMCMP file

MMCMP uncompresses samples in PP20 format.
Rename configure.in to configure.ac
Fix typo, and ensure uint16_t is used.

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Ensure string is null terminated

(complete fix from before from Axel "0vercl0k" Souchet & Florian "Agix" Gaultier)
Bound instruments and samples to appropriate sizes.

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier
Limit numsamples to MAX_SAMPLES-1

Reported by Axel "0vercl0k" Souchet & Florian "Agix" Gaultier