[Sparc] Avoid writing outside array in applyFixup
authorDaniel Cederman <cederman@gaisler.com>
Mon, 27 Aug 2018 11:43:59 +0000 (11:43 +0000)
committerDaniel Cederman <cederman@gaisler.com>
Mon, 27 Aug 2018 11:43:59 +0000 (11:43 +0000)
commitdb474c12e99f92977cf61461171c5cbf7a145fdd
treed9ac6f64348758df82d9bbdcdd421308c300afe2
parent6f7fef7865cf9bf0a5683e45cf672d5537919dbc
[Sparc] Avoid writing outside array in applyFixup

Summary: If an object file ends with a relocation that is smaller
than 4 bytes we will write outside the Data array and trigger an
"Invalid index" assertion.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

Differential Revision: https://reviews.llvm.org/D50971

llvm-svn: 340736
llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
llvm/test/MC/Sparc/sparc-relocations.s