From nobody Wed May 15 11:29:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+94459+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94459+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1664351369; cv=none; d=zohomail.com; s=zohoarc; b=muBGSkG3YADjWzXkCBdd1Ey19Pb715bzEdloQrQKwDzzG2MQfO8p9F/6nRPhOlmtkE5kXhCixxo0UQkSUAUZAkbaBQXiUhtkXsU7neLyiitfYFmGy/FjRfesqihdXUVdeBviUgg67KtEEy9j4WX2sD/eGIvCzlIcjjnIrWo4DIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664351369; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Z2HvNPvivniNRHJ/AmNL+zHHouAThuRcqX+96qVHbT4=; b=XvqG4JJ8z5z6MmGIyXoH90OoC4m7VXaIj7+J9MGBzkxQG/88WcMtJtkms6I2bFyAG1kP6Utt5DD1nsoKtjO+iXE+6/ZKx3KSG9r4fUbtXkcG0XQSnluYzk2l23w0rMFXj3XnPbYIhmrDsiyBi79LMQaVNGdMAPGELrhR0faUAcE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94459+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1664351369680610.3157793376815; Wed, 28 Sep 2022 00:49:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id HRTDYY1788612xIs5wv2HYmx; Wed, 28 Sep 2022 00:49:29 -0700 X-Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by mx.groups.io with SMTP id smtpd.web10.5246.1664351368819791623 for ; Wed, 28 Sep 2022 00:49:28 -0700 X-Received: by mail-pl1-f201.google.com with SMTP id b11-20020a170902d50b00b0017828988079so7889420plg.21 for ; Wed, 28 Sep 2022 00:49:28 -0700 (PDT) X-Gm-Message-State: 6HjqR12NJvLhvdkSceCXxqjhx1787277AA= X-Google-Smtp-Source: AMsMyM77jB1k49w2hZfKelOK1iVZ0JqPm71brjrVU3xUb2z8fAHrLiO5JZvxOdXJzRvQ/ChozgCuWYOlACg= X-Received: from yuanyu.kir.corp.google.com ([2620:15c:29:204:723d:1dc4:5886:3bcf]) (user=yuanyu job=sendgmr) by 2002:a17:90a:cd06:b0:203:ae0e:6a21 with SMTP id d6-20020a17090acd0600b00203ae0e6a21mr557397pju.0.1664351367522; Wed, 28 Sep 2022 00:49:27 -0700 (PDT) Date: Wed, 28 Sep 2022 00:49:24 -0700 In-Reply-To: <20220928074924.528583-1-yuanyu@google.com> Mime-Version: 1.0 References: <20220928074924.528583-1-yuanyu@google.com> Message-ID: <20220928074924.528583-2-yuanyu@google.com> Subject: [edk2-devel] [PATCH v1 1/1] CryptoPkg: Fix integer overflow From: "Yuan Yu via groups.io" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jordan Justen , Laszlo Ersek , Anthony Perard , Julien Grall Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,yuanyu@google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1664351369; bh=Yuv3dT8m6UDKklRZZVBA7A3UI9AFNe81L4Ioiu5jjSc=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=LXSd4POAFO+mpXvcJ/2i8wLZCs3/LmuHZmUkmhKnWh0hlYvUod31iut592NL5FQog5Z PsYqtLdLXiR71gpptGmTu+FwHEzfZ2YyOJaqxZBSTX7MbxmHodUIoWRPO9iycW9eax2ZW ykFFmhTw7zXhCR9FwE5fZrTph6huKQ2tw8M= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1664351369960100004 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Cc: Jordan Justen Cc: Laszlo Ersek Cc: Anthony Perard Cc: Julien Grall Signed-off-by: Yuan Yu Reviewed-by: Ard Biesheuvel --- CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c b/Crypto= Pkg/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)); =20 DayNo =3D (UINT16)(*timer / SECSPERDAY); - DayRemainder =3D (UINT16)(*timer % SECSPERDAY); + DayRemainder =3D (UINT32)(*timer % SECSPERDAY); =20 GmTime->tm_sec =3D (int)(DayRemainder % SECSPERMIN); GmTime->tm_min =3D (int)((DayRemainder % SECSPERHOUR) / SECSPERMIN); --=20 2.37.3.998.g577e59143f-goog -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94459): https://edk2.groups.io/g/devel/message/94459 Mute This Topic: https://groups.io/mt/93968063/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-