public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] staging/edk2-test: TestProfile bug fix
@ 2017-08-02 13:53 Felix Poludov
  2017-08-02 17:37 ` Kinney, Michael D
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Poludov @ 2017-08-02 13:53 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

The patch is a bug fix for TestFrameworkPkg/Support/TestProfile driver.
AsciiStrCpy function was used to copy overlapping strings, which triggered an ASSERT.

The function was used on overlapping strings in a couple of places:
1. _alltrim: AsciiStrCpy is replaced with CopyMem, which can handle overlapping buffers
2. _prosessLine: AsciiStrCpy at the beginning of the function is removed.
The call was redundant. The function was trying to move the data that have already been moved by _alltrim.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Felix Polyudov <felixp@ami.com>
---

diff --git a/TestFrameworkPkg/Support/TestProfile/TestProfile.c b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
index f02e9df..3f0e0d5 100644
--- a/TestFrameworkPkg/Support/TestProfile/TestProfile.c
+++ b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
@@ -269,7 +269,7 @@ Routine Description:
   }
   tmp[Index] = '\0';
-  AsciiStrCpy (ptrStr, tmp);
+  CopyMem(ptrStr, tmp, Index+1);
   return ptrStr;
}
@@ -419,7 +419,7 @@ Routine Description:
   CHAR8 ptrValue[MAX_STRING_LEN + 1];
   INI   *ptrItem;
-  AsciiStrCpy (ptrLine, _alltrim (ptrLine));
+  _alltrim (ptrLine);
   if (*ptrLine == '#') {
     // it's a comment line


Please consider the environment before printing this email.

The information contained in this message may be confidential and proprietary to American Megatrends, Inc.  This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited.  Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging/edk2-test: TestProfile bug fix
  2017-08-02 13:53 [PATCH] staging/edk2-test: TestProfile bug fix Felix Poludov
@ 2017-08-02 17:37 ` Kinney, Michael D
  2017-08-02 17:53   ` Felix Poludov
  0 siblings, 1 reply; 3+ messages in thread
From: Kinney, Michael D @ 2017-08-02 17:37 UTC (permalink / raw)
  To: Felix Poludov, edk2-devel@lists.01.org, Kinney, Michael D

Hi Felix,

Thanks for the contribution.

Do you have a test case that reproduces the issue you found?

Thanks,

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On
> Behalf Of Felix Poludov
> Sent: Wednesday, August 2, 2017 6:54 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH] staging/edk2-test: TestProfile bug fix
> 
> The patch is a bug fix for TestFrameworkPkg/Support/TestProfile
> driver.
> AsciiStrCpy function was used to copy overlapping strings, which
> triggered an ASSERT.
> 
> The function was used on overlapping strings in a couple of
> places:
> 1. _alltrim: AsciiStrCpy is replaced with CopyMem, which can
> handle overlapping buffers
> 2. _prosessLine: AsciiStrCpy at the beginning of the function is
> removed.
> The call was redundant. The function was trying to move the data
> that have already been moved by _alltrim.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Felix Polyudov <felixp@ami.com>
> ---
> 
> diff --git a/TestFrameworkPkg/Support/TestProfile/TestProfile.c
> b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
> index f02e9df..3f0e0d5 100644
> --- a/TestFrameworkPkg/Support/TestProfile/TestProfile.c
> +++ b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
> @@ -269,7 +269,7 @@ Routine Description:
>    }
>    tmp[Index] = '\0';
> -  AsciiStrCpy (ptrStr, tmp);
> +  CopyMem(ptrStr, tmp, Index+1);
>    return ptrStr;
> }
> @@ -419,7 +419,7 @@ Routine Description:
>    CHAR8 ptrValue[MAX_STRING_LEN + 1];
>    INI   *ptrItem;
> -  AsciiStrCpy (ptrLine, _alltrim (ptrLine));
> +  _alltrim (ptrLine);
>    if (*ptrLine == '#') {
>      // it's a comment line
> 
> 
> Please consider the environment before printing this email.
> 
> The information contained in this message may be confidential
> and proprietary to American Megatrends, Inc.  This communication
> is intended to be read only by the individual or entity to whom
> it is addressed or by their designee. If the reader of this
> message is not the intended recipient, you are on notice that
> any distribution of this message, in any form, is strictly
> prohibited.  Please promptly notify the sender by reply e-mail
> or by telephone at 770-246-8600, and then delete or destroy all
> copies of the transmission.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging/edk2-test: TestProfile bug fix
  2017-08-02 17:37 ` Kinney, Michael D
@ 2017-08-02 17:53   ` Felix Poludov
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Poludov @ 2017-08-02 17:53 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org

1. Build the project in debug mode so that asserts are visible.
2. Run "sct -u" command and use SCT GUI to create a sequence file.
3. Run "sct -s <Sequence-File-Name>" command, where <Sequence-File-Name> is a name of the sequence file created in step 2.
The assert is happening during SCT startup when sequence file is parsed.

-----Original Message-----
From: Kinney, Michael D [mailto:michael.d.kinney@intel.com]
Sent: Wednesday, August 02, 2017 1:37 PM
To: Felix Poludov; edk2-devel@lists.01.org; Kinney, Michael D
Subject: RE: [PATCH] staging/edk2-test: TestProfile bug fix

Hi Felix,

Thanks for the contribution.

Do you have a test case that reproduces the issue you found?

Thanks,

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Felix Poludov
> Sent: Wednesday, August 2, 2017 6:54 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH] staging/edk2-test: TestProfile bug fix
>
> The patch is a bug fix for TestFrameworkPkg/Support/TestProfile
> driver.
> AsciiStrCpy function was used to copy overlapping strings, which
> triggered an ASSERT.
>
> The function was used on overlapping strings in a couple of
> places:
> 1. _alltrim: AsciiStrCpy is replaced with CopyMem, which can handle
> overlapping buffers 2. _prosessLine: AsciiStrCpy at the beginning of
> the function is removed.
> The call was redundant. The function was trying to move the data that
> have already been moved by _alltrim.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Felix Polyudov <felixp@ami.com>
> ---
>
> diff --git a/TestFrameworkPkg/Support/TestProfile/TestProfile.c
> b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
> index f02e9df..3f0e0d5 100644
> --- a/TestFrameworkPkg/Support/TestProfile/TestProfile.c
> +++ b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
> @@ -269,7 +269,7 @@ Routine Description:
>    }
>    tmp[Index] = '\0';
> -  AsciiStrCpy (ptrStr, tmp);
> +  CopyMem(ptrStr, tmp, Index+1);
>    return ptrStr;
> }
> @@ -419,7 +419,7 @@ Routine Description:
>    CHAR8 ptrValue[MAX_STRING_LEN + 1];
>    INI   *ptrItem;
> -  AsciiStrCpy (ptrLine, _alltrim (ptrLine));
> +  _alltrim (ptrLine);
>    if (*ptrLine == '#') {
>      // it's a comment line
>
>
> Please consider the environment before printing this email.
>
> The information contained in this message may be confidential and
> proprietary to American Megatrends, Inc.  This communication is
> intended to be read only by the individual or entity to whom it is
> addressed or by their designee. If the reader of this message is not
> the intended recipient, you are on notice that any distribution of
> this message, in any form, is strictly prohibited.  Please promptly
> notify the sender by reply e-mail or by telephone at 770-246-8600, and
> then delete or destroy all copies of the transmission.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

Please consider the environment before printing this email.

The information contained in this message may be confidential and proprietary to American Megatrends, Inc.  This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited.  Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-02 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-02 13:53 [PATCH] staging/edk2-test: TestProfile bug fix Felix Poludov
2017-08-02 17:37 ` Kinney, Michael D
2017-08-02 17:53   ` Felix Poludov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox