diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-12-19 09:30:57 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2017-02-21 13:55:13 +0800 |
commit | 9b002aa44721ab1b5417be60f3ebd55781be27c4 (patch) | |
tree | d9d46ed1e6f30979f6229ff8e587e53f415dfef2 /MdePkg/Library/BasePrintLib/PrintLibInternal.h | |
parent | 063bcff758e9d078dcaa6acfd2476a97176393ea (diff) | |
download | edk2-9b002aa44721ab1b5417be60f3ebd55781be27c4.tar.gz edk2-9b002aa44721ab1b5417be60f3ebd55781be27c4.tar.bz2 edk2-9b002aa44721ab1b5417be60f3ebd55781be27c4.zip |
MdePkg/BasePrintLib: Refine the SPrint functions
For the following 12 APIs in MdePkg/BasePrintLib:
UnicodeVSPrint
UnicodeBSPrint
UnicodeSPrint
UnicodeVSPrintAsciiFormat
UnicodeBSPrintAsciiFormat
UnicodeSPrintAsciiFormat
AsciiVSPrint
AsciiBSPrint
AsciiSPrint
AsciiVSPrintUnicodeFormat
AsciiBSPrintUnicodeFormat
AsciiSPrintUnicodeFormat
They will ASSERT when:
1) The input parameter 'StartOfBuffer' is NULL if 'BufferSize' indicates
at least 1 Ascii/Unicode character can be held.
2) The input parameter 'FormatString' is NULL if 'BufferSize' indicates at
least 1 Ascii/Unicode character can be held.
3) The input parameter 'FormatString' contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.
4) The produced string contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.
This commits removes the ASSERT case 4) and add the following new ASSERT
case:
4) The input parameter 'BufferSize' is greater than
(PcdMaximumAsciiStringLength * sizeof (CHAR8)) for Ascii format string or
(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1) for Unicode format
string.
And for those ASSERT cases, 0 will be returned by those 12 APIs.
For the following 2 APIs in MdePkg/BasePrintLib:
SPrintLength
SPrintLengthAsciiFormat
They will ASSERT when:
1) The input parameter 'FormatString' is NULL.
2) The input parameter 'FormatString' contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.
And for those ASSERT cases, 0 will be returned by those 2 APIs.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdePkg/Library/BasePrintLib/PrintLibInternal.h')
-rw-r--r-- | MdePkg/Library/BasePrintLib/PrintLibInternal.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.h b/MdePkg/Library/BasePrintLib/PrintLibInternal.h index 05f2e1bc99..fccef9b9b9 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.h +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.h @@ -1,7 +1,7 @@ /** @file
Base Print Library instance Internal Functions definition.
- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -19,6 +19,7 @@ #include <Library/PrintLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
//
|