shithub: dumb

Download patch

ref: e431d9dd5f76e49d87acc67e58e84eef0c333839
parent: 90b26f032e7774460c97c7c0b0759563c7069462
author: Christopher Snowhill <kode54@gmail.com>
date: Mon Sep 11 17:00:35 EDT 2017

Fix IT reader for unusually large numbers of components.

--- a/src/it/itread.c
+++ b/src/it/itread.c
@@ -943,6 +943,7 @@
 	int message_length, message_offset;
 
 	IT_COMPONENT *component;
+	int min_components;
 	int n_components = 0;
 
 	unsigned char sample_convert[4096];
@@ -1049,8 +1050,10 @@
 
     dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
 	sigdata->restart_position = 0;
+    
+	min_components = (special & 1) + sigdata->n_instruments + sigdata->n_samples + sigdata->n_patterns;
 
-	component = malloc(769 * sizeof(*component));
+	component = malloc(min_components * sizeof(*component));
 	if (!component) {
 		_dumb_it_unload_sigdata(sigdata);
 		return NULL;