diff options
author | Dandan Bi <dandan.bi@intel.com> | 2017-04-12 11:21:52 +0800 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2017-07-12 11:24:19 +0800 |
commit | 4242ba1bcfb0f82b52935c70661d90c6f7b906ce (patch) | |
tree | f89adcb50af9949bb6cd3df0e4fb3666980637d3 /Core/UefiCpuPkg | |
parent | 0d9a07f019a4fec0f52bc259b6ed14116e3b0f60 (diff) | |
download | edk2-platforms-4242ba1bcfb0f82b52935c70661d90c6f7b906ce.tar.xz |
MdeModulePkg/HiiDB: Avoid incorrect results of multiplication
An example:
The codes in function Output8bitPixel in Image.c:
OffsetY = BITMAP_LEN_8_BIT ((UINT32) Image->Width, Ypos);
Both Image->Width and Ypos are of type UINT16. They will be promoted to
int (signed) first, and then perform the multiplication defined by macro
BITMAP_LEN_8_BIT. If the result of multiplication between Image->Width and
Ypos exceeds the range of type int, a potential incorrect results
will be assigned to OffsetY.
This commit adds explicit UINT32 type cast for 'Image->Width' to avoid
possible overflow in the int range. And also fix similar issues in
HiiDatabase.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
(cherry picked from commit f76bc44362e5f0a2ea509c07b2f6846bd9833ee8)
Diffstat (limited to 'Core/UefiCpuPkg')
0 files changed, 0 insertions, 0 deletions