From 26ad5b82ce6b6feae7fe92bc549e8f4730edf436 Mon Sep 17 00:00:00 2001 From: Henrik Lundin Date: Wed, 31 Jan 2024 15:02:55 +0000 Subject: [PATCH] Fix a fuzzer-found issue in PCM/G.711 decoder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: chromium:1521415 Change-Id: Ia955b59ee40c57bdbbb2a32fa1bf80475df8c743 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/337201 Auto-Submit: Henrik Lundin Commit-Queue: Jakob Ivarsson‎ Reviewed-by: Jakob Ivarsson‎ Cr-Commit-Position: refs/heads/main@{#41646} --- modules/audio_coding/codecs/g711/audio_decoder_pcm.cc | 10 ++++++++++ modules/audio_coding/codecs/g711/audio_decoder_pcm.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc b/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc index 46ac671b30..ff7e919d9b 100644 --- a/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc +++ b/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc @@ -58,6 +58,11 @@ int AudioDecoderPcmU::PacketDuration(const uint8_t* encoded, return static_cast(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 AudioDecoderPcmA::ParsePayload( @@ -99,4 +104,9 @@ int AudioDecoderPcmA::PacketDuration(const uint8_t* encoded, return static_cast(encoded_len / Channels()); } +int AudioDecoderPcmA::PacketDurationRedundant(const uint8_t* encoded, + size_t encoded_len) const { + return PacketDuration(encoded, encoded_len); +} + } // namespace webrtc diff --git a/modules/audio_coding/codecs/g711/audio_decoder_pcm.h b/modules/audio_coding/codecs/g711/audio_decoder_pcm.h index 3fa42cba30..5531d6e7f0 100644 --- a/modules/audio_coding/codecs/g711/audio_decoder_pcm.h +++ b/modules/audio_coding/codecs/g711/audio_decoder_pcm.h @@ -35,6 +35,8 @@ class AudioDecoderPcmU final : public AudioDecoder { std::vector 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 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;