diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index eecafa89768aff8f0ee30c152cd168ae9721fcc5..9c6c94596e3465c7f0cb25189f94a07f95c4e98b 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -438,7 +438,7 @@ private: const uint8_t *start = secData.data() + (*si)->Value; // if this is the last symbol, take up the remaining data. const uint8_t *end = (si + 1 == se) - ? start + secData.size() + ? secData.data() + secData.size() : secData.data() + (*(si + 1))->Value; ArrayRef data(start, end); auto *atom = new (_alloc) COFFDefinedAtom( diff --git a/lld/test/pecoff/hello.test b/lld/test/pecoff/hello.test index cc1e13215e2c3198bd38b167969e62c91f5f34f2..575ff709818bfd96ac25b7abff745af0fb7948c0 100644 --- a/lld/test/pecoff/hello.test +++ b/lld/test/pecoff/hello.test @@ -36,7 +36,7 @@ SECTIONS: } SECTIONS: Section { SECTIONS: Number: 2 SECTIONS: Name: .data (2E 64 61 74 61 00 00 00) -SECTIONS: VirtualSize: 0x18 +SECTIONS: VirtualSize: 0x12 SECTIONS: VirtualAddress: 0x2000 SECTIONS: RawDataSize: 512 SECTIONS: PointerToRawData: 0x400