[edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.

Zhang, Shenglei shenglei.zhang at intel.com
Wed Mar 4 07:59:19 UTC 2020


Reviewed-by: Shenglei Zhang <shenglei.zhang at intel.com>

> -----Original Message-----
> From: devel at edk2.groups.io [mailto:devel at edk2.groups.io] On Behalf Of
> GuoMinJ
> Sent: Thursday, February 20, 2020 9:42 AM
> To: devel at edk2.groups.io
> Cc: GuoMinJ <newexplorerj at gmail.com>
> Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be
> used.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2535
> 
> The UINT_TEST_STATUS and FAILURE_TYPE have used 0 as status, so use 0 as
> unknown is confused, remove it from array enumeration but keep it
> location in the array.
> 
> Signed-off-by: GuoMinJ <newexplorerj at gmail.com>
> ---
>  .../Library/UnitTestResultReportLib/UnitTestResultReportLib.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> eportLib.c
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> eportLib.c
> index 687a04f55d..eba68e330c 100644
> ---
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> eportLib.c
> +++
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> eportLib.c
> @@ -65,7 +65,7 @@ GetStringForUnitTestStatus (
>  {
>    UINTN  Index;
> 
> -  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings); Index++) {
> +  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings) - 1; Index++) {
>      if (mStatusStrings[Index].Status == Status) {
>        //
>        // Return string from matching entry
> @@ -87,7 +87,7 @@ GetStringForFailureType (
>  {
>    UINTN  Index;
> 
> -  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings); Index++) {
> +  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings) - 1; Index++) {
>      if (mFailureTypeStrings[Index].Type == Failure) {
>        //
>        // Return string from matching entry
> --
> 2.17.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55369): https://edk2.groups.io/g/devel/message/55369
Mute This Topic: https://groups.io/mt/71411719/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list