[edk2-devel] [PATCH v1 1/1] CryptoPkg: Fix integer overflow
Yao, Jiewen
jiewen.yao at intel.com
Mon Oct 10 01:11:33 UTC 2022
Merged https://github.com/tianocore/edk2/pull/3456
> -----Original Message-----
> From: Ard Biesheuvel <ardb at kernel.org>
> Sent: Wednesday, September 28, 2022 5:20 PM
> To: Yuan Yu <yuanyu at google.com>; Yao, Jiewen <jiewen.yao at intel.com>;
> Wang, Jian J <jian.j.wang at intel.com>
> Cc: devel at edk2.groups.io; Justen, Jordan L <jordan.l.justen at intel.com>;
> Laszlo Ersek <lersek at redhat.com>; Anthony Perard
> <anthony.perard at citrix.com>; Julien Grall <julien at xen.org>
> Subject: Re: [PATCH v1 1/1] CryptoPkg: Fix integer overflow
>
> (cc Jiewen and Jian)
>
> On Wed, 28 Sept 2022 at 09:49, Yuan Yu <yuanyu at google.com> wrote:
> >
> > SECSPERDAY is 86400 which exceeds the limit of a UINT16 which is 65536.
> > Therefore DayRemainder cannot use UINT16. This patch makes it UINT32.
> >
> > Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
> > Cc: Jordan Justen <jordan.l.justen at intel.com>
> > Cc: Laszlo Ersek <lersek at redhat.com>
> > Cc: Anthony Perard <anthony.perard at citrix.com>
> > Cc: Julien Grall <julien at xen.org>
> >
> > Signed-off-by: Yuan Yu <yuanyu at google.com>
>
> Hello Yuan,
>
> Thanks for the patch.
>
> Reviewed-by: Ard Biesheuvel <ardb at kernel.org>
>
> Since this is a CryptoPkg change, the CryptoPkg maintainers are
> ultimately the ones that need to accept it, so I have added them to
> cc.
>
>
>
> > ---
> > CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
> b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
> > index 7d28446d4b5c..bf8a5325817f 100644
> > --- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
> > +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
> > @@ -118,7 +118,7 @@ gmtime (
> > {
> > struct tm *GmTime;
> > UINT16 DayNo;
> > - UINT16 DayRemainder;
> > + UINT32 DayRemainder;
> > time_t Year;
> > time_t YearNo;
> > UINT16 TotalDays;
> > @@ -136,7 +136,7 @@ gmtime (
> > ZeroMem ((VOID *)GmTime, (UINTN)sizeof (struct tm));
> >
> > DayNo = (UINT16)(*timer / SECSPERDAY);
> > - DayRemainder = (UINT16)(*timer % SECSPERDAY);
> > + DayRemainder = (UINT32)(*timer % SECSPERDAY);
> >
> > GmTime->tm_sec = (int)(DayRemainder % SECSPERMIN);
> > GmTime->tm_min = (int)((DayRemainder % SECSPERHOUR) /
> SECSPERMIN);
> > --
> > 2.37.3.998.g577e59143f-goog
> >
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94852): https://edk2.groups.io/g/devel/message/94852
Mute This Topic: https://groups.io/mt/93968063/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