Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop while reading MIDI file #6

Open
auriamg opened this issue Apr 29, 2013 · 0 comments
Open

Infinite loop while reading MIDI file #6

auriamg opened this issue Apr 29, 2013 · 0 comments

Comments

@auriamg
Copy link

auriamg commented Apr 29, 2013

Hi,

there is a possibility of infinite loop in fileread.cpp; EGetC may abort and set "abort_parse = true", but this boolean is not check by the caller and thus will result in an infinite loop. Fix here :

Index: libjdkmidi/src/jdksmidi_fileread.cpp
===================================================================
--- src/jdksmidi_fileread.cpp   (revision 2257)
+++ src/jdksmidi_fileread.cpp   (working copy)
@@ -468,10 +468,10 @@
             }
             lookfor = to_be_read - lng;
             MsgInit();
-            while ( to_be_read > lookfor )
+            while ( to_be_read > lookfor && !abort_parse )
                 MsgAdd ( EGetC() );

-            if ( !event_handler->MetaEvent ( cur_time, type, act_msg_len, the_msg ) )
+            if ( !abort_parse && !event_handler->MetaEvent ( cur_time, type, act_msg_len, the_msg ) )
                 abort_parse = true;
             break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant