BaseTools: Fix Section header size larger than elf file size bug
Add the logic to handle the case that Section header size larger than elf file size. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
committed by
Yonghong Zhu
parent
3f02180031
commit
d78675d195
@@ -670,6 +670,9 @@ WriteSections64 (
|
||||
switch (Shdr->sh_type) {
|
||||
case SHT_PROGBITS:
|
||||
/* Copy. */
|
||||
if (Shdr->sh_offset + Shdr->sh_size > mFileBufferSize) {
|
||||
return FALSE;
|
||||
}
|
||||
memcpy(mCoffFile + mCoffSectionsOffset[Idx],
|
||||
(UINT8*)mEhdr + Shdr->sh_offset,
|
||||
(size_t) Shdr->sh_size);
|
||||
|
Reference in New Issue
Block a user