We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3900 - [PATCH] timidity/readmidi.c (getvl): check if the read is successful.
Summary: [PATCH] timidity/readmidi.c (getvl): check if the read is successful.
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-21 10:23 UTC by Ozkan Sezer
Modified: 2017-10-21 11:04 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2017-10-21 10:23:44 UTC
readmidi.c (getvl): check if the read is successful.
fixes valgrind warning with broken midi files

diff --git a/timidity/readmidi.c b/timidity/readmidi.c
--- a/timidity/readmidi.c
+++ b/timidity/readmidi.c
@@ -45,7 +45,7 @@ static Sint32 getvl(SDL_RWops *rw)
   Uint8 c;
   for (;;)
     {
-      SDL_RWread(rw, &c, 1, 1);
+      if (!SDL_RWread(rw, &c, 1, 1)) return l;
       l += (c & 0x7f);
       if (!(c & 0x80)) return l;
       l<<=7;
Comment 1 Sam Lantinga 2017-10-21 11:04:05 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL_mixer/rev/6e38c1680f19