From patchwork Tue Feb 12 01:22:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 10807121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEDFF13A4 for ; Tue, 12 Feb 2019 01:23:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF5142AC23 for ; Tue, 12 Feb 2019 01:23:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3A2C2AC2D; Tue, 12 Feb 2019 01:23:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A9BC2AC23 for ; Tue, 12 Feb 2019 01:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727024AbfBLBXW (ORCPT ); Mon, 11 Feb 2019 20:23:22 -0500 Received: from injection.crustytoothpaste.net ([192.241.140.119]:34244 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbfBLBXU (ORCPT ); Mon, 11 Feb 2019 20:23:20 -0500 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:3dc7:72ec:75fa:fee5]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id A49BB60897; Tue, 12 Feb 2019 01:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1549934599; bh=dirQ7xr11Sisxi8H2UaPZ7PLORagH7dGcrdo9rD/WUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=A/ykujYDBPKXWAf/R+h2ibmAx4qovrQ6I1Qp5Hr1pXQrCvnJ6Z5ctXpqYJYXQOObY oHlkupBkjSTXnkeApsAgT1E0q3FXeOX0JULfZRkCKQ0IzTubaR02pvrTURvjtsNViI +b4xpnJbAcGf7nDJbjTPCgU9jwUvmx5oxWQ4u3o77EdtpFUOcyzmVlkXDaBCwqJ74S tKJ/RlaogHBuCXtDQWaP5kBnLyAJBT0oKvgfUXnWuj54vRIN+hAGqVjbMecN5Drl4Y cONwFwLlczNqcQ8IOyJqpX9QGdG9lbv+H1N6Ot2a6Rut4ZUxpFRU2On6Phdozhxr5Q sMBZRV82jKsPolP/ERfHScE3Yo4pqU6NwW27/odZfIGx2U9xsWpbqFtTBGE7gfLOz0 swWidmnqhFfcYy7cl+SRgO2mzOJEQNALNXZUkkoSBUdTt/lu86/TX+yjoNqivG9X4c YJ2zypSMsy5Xf1XgfOTq8NB/z8d+kIGSZvc0lk5VVAftq4l0SYV From: "brian m. carlson" To: Cc: =?utf-8?q?Ren=C3=A9_Scharfe?= , Duy Nguyen Subject: [PATCH 05/31] pack-bitmap: switch hard-coded constants to the_hash_algo Date: Tue, 12 Feb 2019 01:22:30 +0000 Message-Id: <20190212012256.1005924-6-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a In-Reply-To: <20190212012256.1005924-1-sandals@crustytoothpaste.net> References: <20190212012256.1005924-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Switch two hard-coded uses of 20 to references to the_hash_algo. Signed-off-by: brian m. carlson --- pack-bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index 6d6fa68563..603492c237 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -138,7 +138,7 @@ static int load_bitmap_header(struct bitmap_index *index) { struct bitmap_disk_header *header = (void *)index->map; - if (index->map_size < sizeof(*header) + 20) + if (index->map_size < sizeof(*header) + the_hash_algo->rawsz) return error("Corrupted bitmap index (missing header data)"); if (memcmp(header->magic, BITMAP_IDX_SIGNATURE, sizeof(BITMAP_IDX_SIGNATURE)) != 0) @@ -157,7 +157,7 @@ static int load_bitmap_header(struct bitmap_index *index) "(Git requires BITMAP_OPT_FULL_DAG)"); if (flags & BITMAP_OPT_HASH_CACHE) { - unsigned char *end = index->map + index->map_size - 20; + unsigned char *end = index->map + index->map_size - the_hash_algo->rawsz; index->hashes = ((uint32_t *)end) - index->pack->num_objects; } }