summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/BaseBmpSupportLib
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2018-02-13 10:23:51 +0800
committerHao Wu <hao.a.wu@intel.com>2018-02-14 08:19:47 +0800
commit99576ee3fde9228dd5cfedd268f6bc82a0c9f732 (patch)
tree43a26753d8f55e8bd060a39000932141457994dc /MdeModulePkg/Library/BaseBmpSupportLib
parent7ff68b5edc9fda1bd64a70c0e21949d566553484 (diff)
downloadedk2-99576ee3fde9228dd5cfedd268f6bc82a0c9f732.tar.gz
edk2-99576ee3fde9228dd5cfedd268f6bc82a0c9f732.tar.bz2
edk2-99576ee3fde9228dd5cfedd268f6bc82a0c9f732.zip
MdeModulePkg/BmpSupportLib: Refine type cast for pointer subtraction
Since the pointer subtraction here is not performed by pointers to elements of the same array object. This might lead to potential issues, such behavior is undefined according to C11 standard. Refine the pointer subtraction expressions by casting each pointer to UINTN first and then perform the subtraction. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/BaseBmpSupportLib')
-rw-r--r--MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
index 2c95e91ecc..467cd6a58d 100644
--- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -426,7 +426,7 @@ TranslateBmpToGopBlt (
}
- ImageIndex = (UINTN)(Image - ImageHeader);
+ ImageIndex = (UINTN)Image - (UINTN)ImageHeader;
if ((ImageIndex % 4) != 0) {
//
// Bmp Image starts each row on a 32-bit boundary!