diff --git a/VERSION b/VERSION index 97d67e1..5239f46 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -2021 May 10 2021 +2021 May 19 2021 diff --git a/doc/CHANGES b/doc/CHANGES index a79f7d6..c9651c4 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -14204,3 +14204,17 @@ argument is not a power of 2. Fix: changed the return to -1. The program does not crash but the midi file is not created correctly. + + +May 10 2020 + +abc2midi: the following file causes abc2midi to hang. + +X:1 +T: Hangs abc2midi +L:1/4 +K:C +2c/2fac'/c'/c'/c'/c'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +James Allwright intoduced a fix in readlen() in parseabc.c + diff --git a/doc/readme.txt b/doc/readme.txt index 6059e8b..69f6bc1 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -1,7 +1,7 @@ abcMIDI : abc <-> MIDI conversion utilities midi2abc version 3.47 November 01 2020 -abc2midi version 4.54 May 10 2021 +abc2midi version 4.55 May 19 2021 abc2abc version 2.13 May 08 2021 yaps version 1.86 December 10 2020 abcmatch version 1.78 March 27 2021 diff --git a/parseabc.c b/parseabc.c index 395705a..913b0db 100644 --- a/parseabc.c +++ b/parseabc.c @@ -543,37 +543,37 @@ void readsig (char **sig, timesig_details_t *timesig) } } -void -readlen (a, b, p) - int *a, *b; - char **p; + +void readlen (int *a, int *b, char **p) /* read length part of a note and advance character pointer */ { int t; *a = readnump (p); - if (*a == 0) - { - *a = 1; - }; + if (*a == 0) { + *a = 1; + } *b = 1; - if (**p == '/') - { - *p = *p + 1; - *b = readnump (p); - if (*b == 0) - { - *b = 2; - while (**p == '/') - { - *b = *b * 2; - *p = *p + 1; - }; - }; - }; + if (**p == '/') { + *p = *p + 1; + *b = readnump (p); + if (*b == 0) { + *b = 2; + /* [JA] 2021-05-19 prevent infinite loop */ + /* limit the number of '/'s we support */ + while ((**p == '/') && (*b < 1024)) { + *b = *b * 2; + *p = *p + 1; + } + if (*b >= 1024) { + event_warning ("Exceeded maximum note denominator"); + } + } + } *b = check_power_of_two(*b); } + /* [JA] 2020-12-10 */ static void read_L_unitlen(int *num, int *denom, char **place) { diff --git a/store.c b/store.c index d197fea..f3fca69 100644 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.54 May 10 2021 abc2midi" +#define VERSION "4.55 May 19 2021 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1