summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BasePrintLib/PrintLibInternal.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/BasePrintLib/PrintLibInternal.c')
-rw-r--r--MdePkg/Library/BasePrintLib/PrintLibInternal.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
index 89d18b09a2..06c220692e 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
@@ -138,13 +138,20 @@ BasePrintLibConvertValueToString (
UINTN Digits;
UINTN Index;
+ ASSERT (Buffer != NULL);
+ ASSERT (Width < MAXIMUM_VALUE_CHARACTERS);
+ //
+ // Make sure Flags can only contain supported bits.
+ //
+ ASSERT ((Flags & ~(LEFT_JUSTIFY | COMMA_TYPE | PREFIX_ZERO)) == 0);
+
OriginalBuffer = Buffer;
if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
Flags &= (~PREFIX_ZERO);
}
- if (Width == 0 || Width > (MAXIMUM_VALUE_CHARACTERS - 1)) {
+ if (Width == 0) {
Width = MAXIMUM_VALUE_CHARACTERS - 1;
}