File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -153,9 +153,10 @@ void ELFSectionWriter<ELFT>::visit(const CompressedSection &Sec) {
153
153
ArrayRef<uint8_t > Magic = {' Z' , ' L' , ' I' , ' B' };
154
154
std::copy (Magic.begin (), Magic.end (), Buf);
155
155
Buf += Magic.size ();
156
- uint64_t *DecompressedSizePtr = reinterpret_cast <uint64_t *>(Buf);
157
- *DecompressedSizePtr = support::endian::read64be (&Sec.DecompressedSize );
158
- Buf += sizeof (Sec.DecompressedSize );
156
+ const uint64_t DecompressedSize =
157
+ support::endian::read64be (&Sec.DecompressedSize );
158
+ memcpy (Buf, &DecompressedSize, sizeof (DecompressedSize));
159
+ Buf += sizeof (DecompressedSize);
159
160
} else {
160
161
auto Chdr = reinterpret_cast <Elf_Chdr_Impl<ELFT> *>(Buf);
161
162
Chdr->ch_type = ELF::ELFCOMPRESS_ZLIB;
You can’t perform that action at this time.
0 commit comments