summaryrefslogtreecommitdiff
path: root/media-libs/libtimidity/files/libtimidity-0.1.0-newlen-overflow.patch
blob: 22952a5ebba19d791f268a7d4da455003702852b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff -Naur libtimidity-0.1.0/src/resample.c libtimidity-0.1.0-r1/src/resample.c
--- libtimidity-0.1.0/src/resample.c	2004-11-21 23:02:53.000000000 +0100
+++ libtimidity-0.1.0-r1/src/resample.c	2008-02-24 18:46:36.000000000 +0100
@@ -545,7 +545,8 @@
 void pre_resample(MidSong *song, MidSample *sp)
 {
   double a, xdiff;
-  sint32 incr, ofs, newlen, count;
+  sint32 incr, ofs, count;
+  unsigned int newlen;
   sint16 *newdata, *dest, *src = (sint16 *) sp->data;
   sint16 v1, v2, v3, v4, *vptr;
 #ifdef DEBUG_CHATTER
@@ -561,7 +562,7 @@
 
   a = ((double) (sp->sample_rate) * freq_table[(int) (sp->note_to_use)]) /
     ((double) (sp->root_freq) * song->rate);
-  newlen = (sint32)(sp->data_length / a);
+  newlen = (unsigned int)(sp->data_length / a);
   dest = newdata = safe_malloc(newlen >> (FRACTION_BITS - 1));
 
   count = (newlen >> FRACTION_BITS) - 1;