aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/midi/sf2load.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Alc/midi/sf2load.c b/Alc/midi/sf2load.c
index 0d9bc5cb..2bc94133 100644
--- a/Alc/midi/sf2load.c
+++ b/Alc/midi/sf2load.c
@@ -50,9 +50,10 @@ static void skip(Reader *stream, ALuint amt)
size_t got;
got = READ(stream, buf, minu(sizeof(buf), amt));
- if(got == 0) READERR(stream) = 1;
+ if(got == 0 || got > amt)
+ READERR(stream) = 1;
- amt -= got;
+ amt -= (ALuint)got;
}
}