shithub: dumb

Download patch

ref: 02190e007b4967b8a546f64a3934724817ff5c3a
parent: 756ecf2ac0a2b70639193aca55627b64dac8d8d5
author: Chris Moeller <kode54@gmail.com>
date: Sun Dec 9 16:59:33 EST 2012

Fixed MOD pattern count calculation in weird cases where the last sample is missing four bytes

--- a/dumb/src/it/readmod.c
+++ b/dumb/src/it/readmod.c
@@ -647,7 +647,7 @@
 			}
 		}
 		if (remain > total_sample_size) {
-			sigdata->n_patterns = ( remain - total_sample_size ) / ( 256 * sigdata->n_pchannels );
+			sigdata->n_patterns = ( remain - total_sample_size + 4 ) / ( 256 * sigdata->n_pchannels );
 			if (fft == DUMB_ID('M',0,0,0) || fft == DUMB_ID('8',0,0,0)) {
 				remain -= sigdata->n_patterns * 256 * sigdata->n_pchannels;
 				if (dumbfile_skip(f, remain - total_sample_size)) {