Commit 4cd9a604 authored by Sergey Abbakumov's avatar Sergey Abbakumov Committed by Commit Bot

Zero AudioBus internal aligned memory

This prevents from reading uninitialized memory according to MSAN
reports.

Change-Id: Ifccecf69e6df67ab1d2226155a20455ca5c6e293

BUG=856537

Change-Id: Ifccecf69e6df67ab1d2226155a20455ca5c6e293
Reviewed-on: https://chromium-review.googlesource.com/1113935Reviewed-by: default avatarMax Morin <maxmorin@chromium.org>
Commit-Queue: Max Morin <maxmorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570367}
parent 00f2282b
...@@ -73,6 +73,7 @@ AudioBus::AudioBus(int channels, int frames) ...@@ -73,6 +73,7 @@ AudioBus::AudioBus(int channels, int frames)
size, AudioBus::kChannelAlignment))); size, AudioBus::kChannelAlignment)));
BuildChannelData(channels, aligned_frames, data_.get()); BuildChannelData(channels, aligned_frames, data_.get());
Zero();
} }
AudioBus::AudioBus(int channels, int frames, float* data) AudioBus::AudioBus(int channels, int frames, float* data)
......
...@@ -133,6 +133,7 @@ TEST_F(AudioBusTest, Create) { ...@@ -133,6 +133,7 @@ TEST_F(AudioBusTest, Create) {
std::unique_ptr<AudioBus> bus = AudioBus::Create(kChannels, kFrameCount); std::unique_ptr<AudioBus> bus = AudioBus::Create(kChannels, kFrameCount);
VerifyChannelAndFrameCount(bus.get()); VerifyChannelAndFrameCount(bus.get());
VerifyReadWriteAndAlignment(bus.get()); VerifyReadWriteAndAlignment(bus.get());
EXPECT_TRUE(bus->AreFramesZero());
} }
// Verify Create(...) using AudioParameters works as advertised. // Verify Create(...) using AudioParameters works as advertised.
...@@ -142,6 +143,7 @@ TEST_F(AudioBusTest, CreateUsingAudioParameters) { ...@@ -142,6 +143,7 @@ TEST_F(AudioBusTest, CreateUsingAudioParameters) {
kSampleRate, kFrameCount)); kSampleRate, kFrameCount));
VerifyChannelAndFrameCount(bus.get()); VerifyChannelAndFrameCount(bus.get());
VerifyReadWriteAndAlignment(bus.get()); VerifyReadWriteAndAlignment(bus.get());
EXPECT_TRUE(bus->AreFramesZero());
} }
// Verify an AudioBus created via CreateWrapper(...) works as advertised. // Verify an AudioBus created via CreateWrapper(...) works as advertised.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment