mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
fix: add static casts to destination type to avoid overflows in multiplication
Related-To: NEO-9038 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
83c306e927
commit
2ab4aeda85
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -44,12 +44,12 @@ Elf<NumBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErr
|
||||
return {};
|
||||
}
|
||||
|
||||
if (ret.elfFileHeader->phOff + ret.elfFileHeader->phNum * ret.elfFileHeader->phEntSize > binary.size()) {
|
||||
if (ret.elfFileHeader->phOff + static_cast<uint32_t>(ret.elfFileHeader->phNum * ret.elfFileHeader->phEntSize) > binary.size()) {
|
||||
outErrReason = "Out of bounds program headers table";
|
||||
return {};
|
||||
}
|
||||
|
||||
if (ret.elfFileHeader->shOff + ret.elfFileHeader->shNum * ret.elfFileHeader->shEntSize > binary.size()) {
|
||||
if (ret.elfFileHeader->shOff + static_cast<uint32_t>(ret.elfFileHeader->shNum * ret.elfFileHeader->shEntSize) > binary.size()) {
|
||||
outErrReason = "Out of bounds section headers table";
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user