From nobody Mon Apr 29 12:05:17 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1492079772629827.6232373126849; Thu, 13 Apr 2017 03:36:12 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A842921A0483A; Thu, 13 Apr 2017 03:36:10 -0700 (PDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 51C1B21A04811 for ; Thu, 13 Apr 2017 03:36:09 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2017 03:36:08 -0700 Received: from shwde7172.ccr.corp.intel.com ([10.239.9.14]) by fmsmga002.fm.intel.com with ESMTP; 13 Apr 2017 03:36:08 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,194,1488873600"; d="scan'208";a="1155316106" From: Liming Gao To: edk2-devel@lists.01.org Date: Thu, 13 Apr 2017 18:36:05 +0800 Message-Id: <1492079765-15740-1-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 Subject: [edk2] [Patch] MdeModulePkg BrotliLib: Fix the regression logic issue in loop 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Roll back to previous logic, and use point + offset to get byte value. Cc: Bell Song Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c b/= MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c index 67f0ff2..420d1bb 100644 --- a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c +++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c @@ -872,14 +872,14 @@ static BROTLI_NOINLINE void InverseMoveToFrontTransfo= rm( upper_bound =3D 0; for (i =3D 0; i < v_len; ++i) { int index =3D v[i]; - uint8_t value =3D mtf[index]; + uint8_t value =3D *(mtf + index); upper_bound |=3D (uint32_t)v[i]; v[i] =3D value; - mtf[-1] =3D value; - while (index > 0) { + *(mtf - 1) =3D value; + do { index--; - mtf[index + 1] =3D mtf[index]; - } + *(mtf + index + 1) =3D *(mtf + index); + } while (index >=3D 0); } /* Remember amount of elements to be reinitialized. */ state->mtf_upper_bound =3D upper_bound; --=20 2.8.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel