audk/MdeModulePkg
Hao Wu 50418baa69 MdeModulePkg/PrintLib: Refine the SPrint functions
For the following 12 APIs in MdeModulePkg/DxePrintLibPrint2Protocol:
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 MdeModulePkg/DxePrintLibPrint2Protocol:
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.

Now these APIs in the MdeModulePkg/DxePrintLibPrint2Protocol instance
follow the same rules with MdePkg/BasePrintLib.

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>
2017-02-21 13:55:20 +08:00
..
Application MdeModulePkg/CapsuleApp: Dump capsule name in record. 2016-12-23 10:08:04 +08:00
Bus MdeModulePkg/PciBusDxe: Refine code to make it more readable 2017-02-21 11:16:01 +08:00
Core MdeModulePkg PiSmmIpl: Update SmmCommunication comments to match code logic 2017-02-10 11:18:34 +08:00
Include MdeModulePkg/NonDiscoverableDeviceRegistrationLib: Fix coding style issues 2016-12-20 10:51:25 +08:00
Library MdeModulePkg/PrintLib: Refine the SPrint functions 2017-02-21 13:55:20 +08:00
Logo MdeModulePkg/Logo: rebase to ARRAY_SIZE() 2016-10-27 11:10:57 +02:00
Universal MdeModulePkg:Generate the correct operational state of the interface. 2017-02-20 10:09:08 +08:00
Contributions.txt */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
License.txt Update copyright format 2012-04-24 06:49:39 +00:00
MdeModulePkg.dec MdeModulePkg: Update PcdSmbiosDocRev to 0x1 for SMBIOS spec 3.1.1 2017-01-24 18:11:51 +08:00
MdeModulePkg.dsc MdeModulePkg: implement generic PCI I/O driver for non-discoverable devices 2016-12-07 09:45:56 +00:00
MdeModulePkg.uni MdeModulePkg: Add missing info string for PCDs 2016-12-14 21:34:46 +08:00
MdeModulePkgExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00