From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 4D9F73858C56; Thu, 13 Oct 2022 04:18:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D9F73858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665634718; bh=XX8Jb9fXS3827Y42yWpkQiw1q++yFIflqGw3Rs2e23M=; h=From:To:Subject:Date:From; b=lqxqzvXzCVeD1KGoe+xunuwerYJtrAsJg8bASmH87vuv4omPDkhwCCVXtUEowUDA8 X1y/ASd//x3ZgOD9yrKCXpkqgcB+rCEBWxCzRJOKQ0q33xjMbXzcBPotBwfzzGJ3fl s783cTit1mH//wdq+xttZQ7oxZaBIc4P2JZeZ+/w= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] malloc: Switch global_max_fast to uint8_t X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: ba0ca36132d72d88f577062520b479b4b97df114 X-Git-Newrev: 15a94e6668a6d7c5697e805d8d67f1d102d0d52e Message-Id: <20221013041838.4D9F73858C56@sourceware.org> Date: Thu, 13 Oct 2022 04:18:38 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=15a94e6668a6d7c5697e805d8d67f1d102d0d52e commit 15a94e6668a6d7c5697e805d8d67f1d102d0d52e Author: Florian Weimer Date: Thu Oct 13 05:45:41 2022 +0200 malloc: Switch global_max_fast to uint8_t MAX_FAST_SIZE is 160 at most, so a uint8_t is sufficient. This makes it harder to use memory corruption, by overwriting global_max_fast with a large value, to fundamentally alter malloc behavior. Reviewed-by: DJ Delorie Diff: --- malloc/malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/malloc/malloc.c b/malloc/malloc.c index 953183e956..2a61c8b5ee 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1757,7 +1757,7 @@ typedef struct malloc_chunk *mfastbinptr; #define set_contiguous(M) ((M)->flags &= ~NONCONTIGUOUS_BIT) /* Maximum size of memory handled in fastbins. */ -static INTERNAL_SIZE_T global_max_fast; +static uint8_t global_max_fast; /* Set value of max_fast.