From d942f874ae1ddb131e846eee89f6e6037b3f0e6f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 12 Mar 2020 20:29:15 +0100 Subject: [PATCH] lib/chromaprint/DecoderClient: check `ready` in GetCommand() Fixes access to uninitialized memory (`remaining_bytes` isn't initialized until Ready() is called) and fixes spurious `getfingerprint` failures. --- src/lib/chromaprint/DecoderClient.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/chromaprint/DecoderClient.hxx b/src/lib/chromaprint/DecoderClient.hxx index 8d2aa6a21..041ba194a 100644 --- a/src/lib/chromaprint/DecoderClient.hxx +++ b/src/lib/chromaprint/DecoderClient.hxx @@ -71,7 +71,7 @@ public: bool seekable, SignedSongTime duration) noexcept override; DecoderCommand GetCommand() noexcept override { - return !error && remaining_bytes > 0 + return !error && (!ready || remaining_bytes > 0) ? DecoderCommand::NONE : DecoderCommand::STOP; }