MdePkg/BasePeCoffLib: Add more check for relocation data
authorDandan Bi <dandan.bi@intel.com>
Thu, 3 Jan 2019 07:31:23 +0000 (15:31 +0800)
committerLiming Gao <liming.gao@intel.com>
Wed, 16 Jan 2019 14:38:00 +0000 (22:38 +0800)
commit2f4a5a9f4c17ed88aaa3114d1e161e42cb80a9bf
treed29e4f1cde071e9e131df57c47f5a7ed0d2e2eb9
parent9e90fb097c1526b6fb96082cd3438c2835e54cc5
MdePkg/BasePeCoffLib: Add more check for relocation data

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1426

V2:
(1) Add NULL pointer check for the input parameters
(2) Add check for the "Adjust" value before applying fix ups.

In function PeCoffLoaderRelocateImageForRuntime, it doesn't
do much check when do relocation. For API level consideration,
it's not safe enough.
So this patch is to replace the same code logic with function
PeCoffLoaderImageAddress which will cover more validation.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Library/BasePeCoffLib/BasePeCoff.c