From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 749DC21A18AAA for ; Sun, 16 Apr 2017 20:17:42 -0700 (PDT) Received: from G9W8454.americas.hpqcorp.net (g9w8454.houston.hp.com [16.216.161.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3427.houston.hpe.com (Postfix) with ESMTPS id B796C53 for ; Mon, 17 Apr 2017 03:17:41 +0000 (UTC) Received: from G9W8455.americas.hpqcorp.net (2002:10d8:a15e::10d8:a15e) by G9W8454.americas.hpqcorp.net (2002:10d8:a104::10d8:a104) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Mon, 17 Apr 2017 03:17:41 +0000 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (15.241.52.12) by G9W8455.americas.hpqcorp.net (16.216.161.94) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Mon, 17 Apr 2017 03:17:41 +0000 Received: from DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM (10.162.192.143) by DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM (10.162.192.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Mon, 17 Apr 2017 03:17:39 +0000 Received: from DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM ([10.162.192.143]) by DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM ([10.162.192.143]) with mapi id 15.01.1034.013; Mon, 17 Apr 2017 03:17:39 +0000 From: "Subramanian, Sriram" To: Jiaxin Wu , "edk2-devel@lists.01.org" CC: Ye Ting , Zhang Lubo , Fu Siyuan Thread-Topic: [edk2] [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure Thread-Index: AQHStEHmK53Hk1TgJ0a6109Zga/dH6HI6a1Q Date: Mon, 17 Apr 2017 03:17:39 +0000 Message-ID: References: <1492079802-180-1-git-send-email-jiaxin.wu@intel.com> In-Reply-To: <1492079802-180-1-git-send-email-jiaxin.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [16.242.235.130] x-microsoft-exchange-diagnostics: 1; DF4PR84MB0041; 7:D7VCjf0GDfs6NGfosYw1TeC0WjfibeMmskNbwmvuPftfkJyfFfPu4w/j/srMpQz/OwhWjHVVfEqNAyusP59LRJSjjOUpsEc2CtU4FBbLNgCGh/oIQZQwnmPlQ/BToddeBLjDbRRdef+BFaG0V11VnPecwqjv2/psTiHcHGcJTJ8SUzda7rkYLTEUFKifCHXgCK89/+s90DEq/OGn+raefNgaZt/51tAZAFHsN7hw/AZFPLgkQocebweQNfONQwSk4nQLhnLLR/vGafOJeoElHhMc3ES4pBD9eLNn5dYtr8a2mACcNgF382DcYZlZLNjja63ej7FDBHrpuimH9A8H4g== x-ms-office365-filtering-correlation-id: e51d3e17-0938-4f53-521b-08d485404dd6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:DF4PR84MB0041; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:DF4PR84MB0041; BCL:0; PCL:0; RULEID:; SRVR:DF4PR84MB0041; x-forefront-prvs: 02801ACE41 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(39840400002)(39400400002)(39860400002)(39450400003)(39410400002)(39850400002)(13464003)(377454003)(189998001)(122556002)(81166006)(2906002)(66066001)(7736002)(305945005)(50986999)(6506006)(33656002)(8936002)(229853002)(74316002)(8676002)(5660300001)(2950100002)(7696004)(3280700002)(3660700001)(6246003)(76176999)(6116002)(38730400002)(6436002)(3846002)(102836003)(77096006)(2900100001)(6306002)(55016002)(86362001)(2501003)(53936002)(9686003)(4326008)(53546009)(25786009)(54356999); DIR:OUT; SFP:1102; SCL:1; SRVR:DF4PR84MB0041; H:DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Apr 2017 03:17:39.5750 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR84MB0041 X-OriginatorOrg: hpe.com Subject: Re: [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Apr 2017 03:17:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sriram Subramanian -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiax= in Wu Sent: Thursday, April 13, 2017 4:07 PM To: edk2-devel@lists.01.org Cc: Ye Ting ; Zhang Lubo ; Fu Siyu= an ; Wu Jiaxin Subject: [edk2] [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over= 4G size failure UINT32 integer overflow will happen once the download OS image over 4G size. This patch is to fix this issue. Cc: Ye Ting Cc: Fu Siyuan Cc: Zhang Lubo Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/HttpDxe/HttpProto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.= c index 3d61ba2..3fda294 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -2029,24 +2029,24 @@ HttpTcpReceiveBody ( ASSERT (Tcp4 !=3D NULL); } =20 if (HttpInstance->LocalAddressIsIPv6) { Rx6Token =3D &Wrap->TcpWrap.Rx6Token; - Rx6Token ->Packet.RxData->DataLength =3D (UINT32) HttpMsg->BodyLength; - Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength =3D (UINT32)= HttpMsg->BodyLength; + Rx6Token ->Packet.RxData->DataLength =3D (UINT32) MIN (MAX_UINT32, Htt= pMsg->BodyLength); + Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength =3D (UINT32)= MIN (MAX_UINT32, HttpMsg->BodyLength); Rx6Token ->Packet.RxData->FragmentTable[0].FragmentBuffer =3D (VOID *)= HttpMsg->Body; Rx6Token->CompletionToken.Status =3D EFI_NOT_READY; =20 Status =3D Tcp6->Receive (Tcp6, Rx6Token); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Tcp6 receive failed: %r\n", Status)); return Status; } } else { Rx4Token =3D &Wrap->TcpWrap.Rx4Token; - Rx4Token->Packet.RxData->DataLength =3D (UINT32) HttpMsg->BodyLength; - Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength =3D (UINT32) = HttpMsg->BodyLength; + Rx4Token->Packet.RxData->DataLength =3D (UINT32) MIN (MAX_UINT32, Http= Msg->BodyLength); + Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength =3D (UINT32) = MIN (MAX_UINT32, HttpMsg->BodyLength); Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer =3D (VOID *) = HttpMsg->Body; =20 Rx4Token->CompletionToken.Status =3D EFI_NOT_READY; Status =3D Tcp4->Receive (Tcp4, Rx4Token); if (EFI_ERROR (Status)) { --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel