Commit dadd3ca6 authored by Max Kellermann's avatar Max Kellermann

protocol/ArgParser: disallow negative seek times

Instead of stopping playback (due to seek time overflow), reject the seek command. Closes #240 Relative negative values (with "seekcur") are still allowed, and MPD will fix the resulting position if it turns out to be negative. But the "seek" and "seekid" commands use an unsigned time stamp which must not be negative.
parent 79535212
ver 0.20.19 (not yet released)
* protocol
- validate absolute seek time, reject negative values
* macOS: fix crash bug
ver 0.20.18 (2018/02/24)
......
......@@ -164,6 +164,10 @@ SongTime
ParseCommandArgSongTime(const char *s)
{
auto value = ParseCommandArgFloat(s);
if (value < 0)
throw FormatProtocolError(ACK_ERROR_ARG,
"Negative value not allowed: %s", s);
return SongTime::FromS(value);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment