From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.1 To: devel@lists.altlinux.org References: <20191210152343.33867-1-darktemplar@altlinux.org> <20191210152343.33867-27-darktemplar@altlinux.org> <20191210225754.GA32733@altlinux.org> From: Aleksei Nikiforov Message-ID: <59355380-012f-3fdf-cf2f-32e6ca4e9d3e@altlinux.org> Date: Wed, 11 Dec 2019 10:51:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191210225754.GA32733@altlinux.org> Content-Type: text/plain; charset=koi8-r; format=flowed Content-Language: ru Content-Transfer-Encoding: 8bit Subject: Re: [devel] [PATCH for apt 26/38] Fix warning about truncation of value of pkgCache::Header::HeaderSz X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2019 07:51:34 -0000 Archived-At: List-Archive: List-Post: 11.12.2019 1:58, Dmitry V. Levin пишет: > On Tue, Dec 10, 2019 at 06:23:31PM +0300, Aleksei Nikiforov wrote: >> Update types of other variables as well. > > What's the rationale for changing types of *all* these fields, > and for choosing architecture-dependent "unsigned long" > as the new type instead of "unsigned short"? Value of HeaderSz is truncated. IIRC, assigned value was around 270k. Types of other variables were changed for uniformity and possible mitigation of same overflow issues in future, but may be reverted for now. Since type wasn't architecture-independent, similar architecture-dependent type of bigger size was used. All of this may be changed as needed, with only exception of keeping size of HeaderSz increased. > >> --- >> apt/apt-pkg/pkgcache.h | 14 +++++++------- >> 1 file changed, 7 insertions(+), 7 deletions(-) >> >> diff --git a/apt/apt-pkg/pkgcache.h b/apt/apt-pkg/pkgcache.h >> index 05a63bc..6b44522 100644 >> --- a/apt/apt-pkg/pkgcache.h >> +++ b/apt/apt-pkg/pkgcache.h >> @@ -175,13 +175,13 @@ struct pkgCache::Header >> unsigned long OptionsHash; >> >> // Size of structure values >> - unsigned short HeaderSz; >> - unsigned short PackageSz; >> - unsigned short PackageFileSz; >> - unsigned short VersionSz; >> - unsigned short DependencySz; >> - unsigned short ProvidesSz; >> - unsigned short VerFileSz; >> + unsigned long HeaderSz; >> + unsigned long PackageSz; >> + unsigned long PackageFileSz; >> + unsigned long VersionSz; >> + unsigned long DependencySz; >> + unsigned long ProvidesSz; >> + unsigned long VerFileSz; >> >> // Structure counts >> unsigned long PackageCount; > > > _______________________________________________ > Devel mailing list > Devel@lists.altlinux.org > https://lists.altlinux.org/mailman/listinfo/devel >