From: Jacek Caban Date: Fri, 21 Apr 2023 23:47:55 +0000 (+0000) Subject: [Object] Always initialized StartOfFile in Archive::Child::Child constructor. X-Git-Tag: upstream/17.0.6~10748 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebee5e0473df7685086eb2f4ffb07e1bf965b3bd;p=platform%2Fupstream%2Fllvm.git [Object] Always initialized StartOfFile in Archive::Child::Child constructor. Fixes uninitialized memory access revealed by https://reviews.llvm.org/D146534. In empty archives, we use Child(nullptr,nullptr,nullptr) in Archive constructor in setFirstRegular. This copies unitialized StartOfFile to FirstRegularStartOfFile, which child_begin may use later. Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D148955 --- diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index 6ddbe35..081ff79 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -468,6 +468,7 @@ Archive::Child::Child(const Archive *Parent, const char *Start, Error *Err) : Parent(Parent) { if (!Start) { Header = nullptr; + StartOfFile = -1; return; }