diff options
author | Max Kellermann <max@musicpd.org> | 2018-03-04 11:46:11 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-03-04 11:46:11 +0100 |
commit | dadd3ca6716f37fdb530a48e9ef98e0fa6bc6a89 (patch) | |
tree | 2df2eee9b33e26ab52ac3ecf14601b30e31fdfb0 /src/protocol | |
parent | 79535212c871a0428a813c72cf349332d6d5d165 (diff) |
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.
Diffstat (limited to 'src/protocol')
-rw-r--r-- | src/protocol/ArgParser.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index 47fdfa405..bdc28bcbf 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -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); } |