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.
This commit is contained in:
parent
79535212c8
commit
dadd3ca671
2
NEWS
2
NEWS
|
@ -1,4 +1,6 @@
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue