Fix a fuzzer-found issue in PCM/G.711 decoder

Bug: chromium:1521415
Change-Id: Ia955b59ee40c57bdbbb2a32fa1bf80475df8c743
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/337201
Auto-Submit: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Jakob Ivarsson‎ <jakobi@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41646}
This commit is contained in:
Henrik Lundin 2024-01-31 15:02:55 +00:00 committed by WebRTC LUCI CQ
parent 9b7f3649af
commit 26ad5b82ce
2 changed files with 14 additions and 0 deletions

View File

@ -58,6 +58,11 @@ int AudioDecoderPcmU::PacketDuration(const uint8_t* encoded,
return static_cast<int>(encoded_len / Channels());
}
int AudioDecoderPcmU::PacketDurationRedundant(const uint8_t* encoded,
size_t encoded_len) const {
return PacketDuration(encoded, encoded_len);
}
void AudioDecoderPcmA::Reset() {}
std::vector<AudioDecoder::ParseResult> AudioDecoderPcmA::ParsePayload(
@ -99,4 +104,9 @@ int AudioDecoderPcmA::PacketDuration(const uint8_t* encoded,
return static_cast<int>(encoded_len / Channels());
}
int AudioDecoderPcmA::PacketDurationRedundant(const uint8_t* encoded,
size_t encoded_len) const {
return PacketDuration(encoded, encoded_len);
}
} // namespace webrtc

View File

@ -35,6 +35,8 @@ class AudioDecoderPcmU final : public AudioDecoder {
std::vector<ParseResult> ParsePayload(rtc::Buffer&& payload,
uint32_t timestamp) override;
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
int PacketDurationRedundant(const uint8_t* encoded,
size_t encoded_len) const override;
int SampleRateHz() const override;
size_t Channels() const override;
@ -62,6 +64,8 @@ class AudioDecoderPcmA final : public AudioDecoder {
std::vector<ParseResult> ParsePayload(rtc::Buffer&& payload,
uint32_t timestamp) override;
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
int PacketDurationRedundant(const uint8_t* encoded,
size_t encoded_len) const override;
int SampleRateHz() const override;
size_t Channels() const override;