- Update DUMB to revision 3aee7f113c66f19e93f9e41a6e280e12dfd9a0e9

- Fixed envelope reading to gracefully handle nodes which are out of range



SVN r4116 (trunk)
This commit is contained in:
Randy Heit 2013-02-08 01:34:05 +00:00
parent cfaecc12a3
commit 3c50b1c14b
1 changed files with 7 additions and 6 deletions

View File

@ -338,7 +338,7 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
static int it_xm_make_envelope(IT_ENVELOPE *envelope, const unsigned short *data, int y_offset)
{
int i, pos;
int i, pos, val;
if (envelope->n_nodes > 12) {
/* XXX
@ -355,12 +355,13 @@ static int it_xm_make_envelope(IT_ENVELOPE *envelope, const unsigned short *data
pos = 0;
for (i = 0; i < envelope->n_nodes; i++) {
envelope->node_t[i] = data[pos++];
if (data[pos] > 64) {
TRACE("XM error: out-of-range envelope node (node_y[%d]=%d)\n", i, data[pos]);
envelope->n_nodes = 0;
return -1;
val = data[pos++];
if (val > 64) {
TRACE("XM error: out-of-range envelope node (node_y[%d]=%d)\n", i, val);
/* FT2 seems to simply clip the value */
val = 64;
}
envelope->node_y[i] = (signed char)(data[pos++] + y_offset);
envelope->node_y[i] = (signed char)(val + y_offset);
}
return 0;