summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source
diff options
context:
space:
mode:
authorKinney, Michael D <michael.d.kinney@intel.com>2018-07-27 12:27:19 -0700
committerKinney, Michael D <michael.d.kinney@intel.com>2018-08-02 14:35:22 -0700
commit6ed4651cb560caba91a989550734206f01ffd7d1 (patch)
tree45e8b8c2c2634a201b02e8bc9a155d0cc1729d15 /BaseTools/Source
parente4005ecb0b2f8223c04588b52cd16d3edfc60acf (diff)
downloadedk2-6ed4651cb560caba91a989550734206f01ffd7d1.tar.gz
edk2-6ed4651cb560caba91a989550734206f01ffd7d1.tar.bz2
edk2-6ed4651cb560caba91a989550734206f01ffd7d1.zip
BaseTools/Capsule: Add max value checks to Capsule Generation tools
https://bugzilla.tianocore.org/show_bug.cgi?id=1021 https://bugzilla.tianocore.org/show_bug.cgi?id=1022 https://bugzilla.tianocore.org/show_bug.cgi?id=1026 Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source')
-rw-r--r--BaseTools/Source/Python/Capsule/GenerateCapsule.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
index 4018dc0420..5398c12a9c 100644
--- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
+++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
@@ -298,6 +298,12 @@ if __name__ == '__main__':
parser.error ('--capflag PopulateSystemTable also requires --capflag PersistAcrossReset')
if 'InitiateReset' in args.CapsuleFlag:
parser.error ('--capflag InitiateReset also requires --capflag PersistAcrossReset')
+ if args.CapsuleOemFlag > 0xFFFF:
+ parser.error ('--capoemflag must be an integer between 0x0000 and 0xffff')
+ if args.HardwareInstance > 0xFFFFFFFFFFFFFFFF:
+ parser.error ('--hardware-instance must be an integer in range 0x0..0xffffffffffffffff')
+ if args.MonotonicCount > 0xFFFFFFFFFFFFFFFF:
+ parser.error ('--monotonic-count must be an integer in range 0x0..0xffffffffffffffff')
UseSignTool = args.SignToolPfxFile is not None
UseOpenSsl = (args.OpenSslSignerPrivateCertFile is not None and
@@ -319,6 +325,10 @@ if __name__ == '__main__':
if args.Encode and (UseSignTool or UseOpenSsl):
if args.FwVersion is None or args.LowestSupportedVersion is None:
parser.error ('the following options are required: --fw-version, --lsv')
+ if args.FwVersion > 0xFFFFFFFF:
+ parser.error ('--fw-version must be an integer in range 0x0..0xffffffff')
+ if args.LowestSupportedVersion > 0xFFFFFFFF:
+ parser.error ('--lsv must be an integer in range 0x0..0xffffffff')
if UseSignTool:
args.SignToolPfxFile.close()