Skip to content

Commit afa2870

Browse files
Dominique Clauseivanpenkov
authored andcommitted
Zero-initialize variables in static_range_map_unittest.cc
This is upstreaming a fix from Google. MSan reports use-of-uninitialized-value in google_breakpad::TestStaticRangeMap::RetrieveTest because it cannot track memory initialized via syscalls like sys_fstat. Introducing zero-initialization using nullptr or zero-value of local variables. Bug: 504132777 Change-Id: Ia2643088afd0196ab9fe88321c92bec10f877f61 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/7792919 Reviewed-by: Ivan Penkov <ivanpe@google.com> Reviewed-by: Nelson Billing <nbilling@google.com>
1 parent ccce0bf commit afa2870

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/processor/static_range_map_unittest.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ void TestStaticRangeMap::RetrieveTest(TestMap* range_map,
248248
expected_result = !side; // should succeed low and fail high.
249249
}
250250

251-
const EntryType* id;
252-
AddressType retrieved_base;
253-
AddressType retrieved_size;
251+
const EntryType* id = nullptr;
252+
AddressType retrieved_base = 0;
253+
AddressType retrieved_size = 0;
254254
bool retrieved = range_map->RetrieveRange(address, id,
255255
&retrieved_base,
256256
&retrieved_size);
@@ -278,8 +278,8 @@ void TestStaticRangeMap::RetrieveTest(TestMap* range_map,
278278
if (!side && offset < 0)
279279
expected_nearest = false;
280280

281-
AddressType nearest_base;
282-
AddressType nearest_size;
281+
AddressType nearest_base = 0;
282+
AddressType nearest_size = 0;
283283
bool retrieved_nearest = range_map->RetrieveNearestRange(address,
284284
id,
285285
&nearest_base,
@@ -317,10 +317,10 @@ void TestStaticRangeMap::RetrieveTest(TestMap* range_map,
317317
void TestStaticRangeMap::RetrieveIndexTest(const TestMap* range_map, int set) {
318318
AddressType last_base = 0;
319319
const EntryType* last_entry = 0;
320-
const EntryType* entry;
320+
const EntryType* entry = nullptr;
321321
int object_count = range_map->GetCount();
322322
for (int object_index = 0; object_index < object_count; ++object_index) {
323-
AddressType base;
323+
AddressType base = 0;
324324
ASSERT_TRUE(range_map->RetrieveRangeAtIndex(object_index,
325325
entry,
326326
&base,

0 commit comments

Comments
 (0)