[edk2] [PATCH v2 0/2] Fix error in PrintLib

Jian J Wang posted 2 patches 6 years, 3 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c | 7 +++++--
MdePkg/Library/BasePrintLib/PrintLibInternal.c            | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
[edk2] [PATCH v2 0/2] Fix error in PrintLib
Posted by Jian J Wang 6 years, 3 months ago
> v2:
>    a. Correct incorrect description in commit log
>    b. Fix another similar issue in the same function
>    c. Fix similar issues in MdeModulePkg/DxePrintLibPrint2Protocol

Due to a potential hole in the stop condition of the loop, the two continuous
access to ArgumentString (index, index+1) inside the loop might cause the
string ending character ('\0') and the byte after it to be read.

Jian J Wang (2):
  MdePkg/BasePrintLib: Fix error in Precision position calculation
  MdeModulePkg/DxePrintLibPrint2Protocol: Fix potential string over read

 MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c | 7 +++++--
 MdePkg/Library/BasePrintLib/PrintLibInternal.c            | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

-- 
2.15.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 0/2] Fix error in PrintLib
Posted by Gao, Liming 6 years, 3 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jian J Wang
> Sent: Thursday, December 28, 2017 10:38 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v2 0/2] Fix error in PrintLib
> 
> > v2:
> >    a. Correct incorrect description in commit log
> >    b. Fix another similar issue in the same function
> >    c. Fix similar issues in MdeModulePkg/DxePrintLibPrint2Protocol
> 
> Due to a potential hole in the stop condition of the loop, the two continuous
> access to ArgumentString (index, index+1) inside the loop might cause the
> string ending character ('\0') and the byte after it to be read.
> 
> Jian J Wang (2):
>   MdePkg/BasePrintLib: Fix error in Precision position calculation
>   MdeModulePkg/DxePrintLibPrint2Protocol: Fix potential string over read
> 
>  MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c | 7 +++++--
>  MdePkg/Library/BasePrintLib/PrintLibInternal.c            | 7 +++++--
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> --
> 2.15.1.windows.2
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 0/2] Fix error in PrintLib
Posted by Zeng, Star 6 years, 3 months ago
Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jian J Wang
Sent: Thursday, December 28, 2017 10:38 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v2 0/2] Fix error in PrintLib

> v2:
>    a. Correct incorrect description in commit log
>    b. Fix another similar issue in the same function
>    c. Fix similar issues in MdeModulePkg/DxePrintLibPrint2Protocol

Due to a potential hole in the stop condition of the loop, the two continuous access to ArgumentString (index, index+1) inside the loop might cause the string ending character ('\0') and the byte after it to be read.

Jian J Wang (2):
  MdePkg/BasePrintLib: Fix error in Precision position calculation
  MdeModulePkg/DxePrintLibPrint2Protocol: Fix potential string over read

 MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c | 7 +++++--
 MdePkg/Library/BasePrintLib/PrintLibInternal.c            | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

--
2.15.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 0/2] Fix error in PrintLib
Posted by Kinney, Michael D 6 years, 3 months ago
Jian,

This change breaks GCC5 builds.

/home/mdkinney/tianocore/edk2/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c: In function 'InternalPrintLibSPrintMarker':
/home/mdkinney/tianocore/edk2/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c:2054:71: error: suggest parentheses around '&&' within '||' [-Werror=parentheses]
             ArgumentString[Count * BytesPerArgumentCharacter] != '\0' &&
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
             Count < Precision || ((Flags & PRECISION) == 0);
             ~~~~~~~~~~~~~~~~~

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-
> bounces@lists.01.org] On Behalf Of Jian J Wang
> Sent: Wednesday, December 27, 2017 6:38 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v2 0/2] Fix error in PrintLib
> 
> > v2:
> >    a. Correct incorrect description in commit log
> >    b. Fix another similar issue in the same function
> >    c. Fix similar issues in
> MdeModulePkg/DxePrintLibPrint2Protocol
> 
> Due to a potential hole in the stop condition of the
> loop, the two continuous
> access to ArgumentString (index, index+1) inside the
> loop might cause the
> string ending character ('\0') and the byte after it to
> be read.
> 
> Jian J Wang (2):
>   MdePkg/BasePrintLib: Fix error in Precision position
> calculation
>   MdeModulePkg/DxePrintLibPrint2Protocol: Fix potential
> string over read
> 
> 
> MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib
> .c | 7 +++++--
>  MdePkg/Library/BasePrintLib/PrintLibInternal.c
> | 7 +++++--
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> --
> 2.15.1.windows.2
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 0/2] Fix error in PrintLib
Posted by Wang, Jian J 6 years, 3 months ago
Mike,

Thanks for catching it. The patch has sent out.

Regards,
Jian


> -----Original Message-----
> From: Kinney, Michael D
> Sent: Friday, December 29, 2017 9:08 AM
> To: Wang, Jian J <jian.j.wang@intel.com>; edk2-devel@lists.01.org; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Subject: RE: [edk2] [PATCH v2 0/2] Fix error in PrintLib
> 
> Jian,
> 
> This change breaks GCC5 builds.
> 
> /home/mdkinney/tianocore/edk2/MdeModulePkg/Library/DxePrintLibPrint2Pro
> tocol/PrintLib.c: In function 'InternalPrintLibSPrintMarker':
> /home/mdkinney/tianocore/edk2/MdeModulePkg/Library/DxePrintLibPrint2Pro
> tocol/PrintLib.c:2054:71: error: suggest parentheses around '&&' within '||' [-
> Werror=parentheses]
>              ArgumentString[Count * BytesPerArgumentCharacter] != '\0' &&
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
>              Count < Precision || ((Flags & PRECISION) == 0);
>              ~~~~~~~~~~~~~~~~~
> 
> Mike
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-
> > bounces@lists.01.org] On Behalf Of Jian J Wang
> > Sent: Wednesday, December 27, 2017 6:38 PM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH v2 0/2] Fix error in PrintLib
> >
> > > v2:
> > >    a. Correct incorrect description in commit log
> > >    b. Fix another similar issue in the same function
> > >    c. Fix similar issues in
> > MdeModulePkg/DxePrintLibPrint2Protocol
> >
> > Due to a potential hole in the stop condition of the
> > loop, the two continuous
> > access to ArgumentString (index, index+1) inside the
> > loop might cause the
> > string ending character ('\0') and the byte after it to
> > be read.
> >
> > Jian J Wang (2):
> >   MdePkg/BasePrintLib: Fix error in Precision position
> > calculation
> >   MdeModulePkg/DxePrintLibPrint2Protocol: Fix potential
> > string over read
> >
> >
> > MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib
> > .c | 7 +++++--
> >  MdePkg/Library/BasePrintLib/PrintLibInternal.c
> > | 7 +++++--
> >  2 files changed, 10 insertions(+), 4 deletions(-)
> >
> > --
> > 2.15.1.windows.2
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel