From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.4 required=3.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id AEBD01F54E for ; Fri, 5 Aug 2022 14:48:52 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=github.com header.i=@github.com header.b="gLfnjPuT"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240323AbiHEOst (ORCPT ); Fri, 5 Aug 2022 10:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236448AbiHEOsr (ORCPT ); Fri, 5 Aug 2022 10:48:47 -0400 Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 407E81FCDA for ; Fri, 5 Aug 2022 07:48:47 -0700 (PDT) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-10ea7d8fbf7so3160788fac.7 for ; Fri, 05 Aug 2022 07:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=M7eElAXI//OulkqMJ68oUQY668ss4wS2KbchX6x49os=; b=gLfnjPuTbxtMjLhDi1h31ZzcIfN8uukz63MiRb8UQgAEebE2GzaIU4L6aMxE6q5vCF Hw67u1y1t0cLi0ypINrdUBT1bN6JscdpCoVgWZPA1TPCFwznTI4RAiH3Ln9R6Bq3EnJ7 m5+s/O3OP/Dj/h07uNgFK4F2YAdEFbp5Kj67ts8fI8ngmvg/9lOqyW5IWo8cKXcLxRPP MJuQmQXklXZzTWj73klYBhoUbyr8/bCDJz2JInrBQXtomysHACkqIpmMAbAXewrUmXYG PniZ19nx15HFapZV+J0BNVWAwQkPFJv3eNTVqUGF1NMyN6+SJoXAEo2CiOfaddGTIOY4 fV3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=M7eElAXI//OulkqMJ68oUQY668ss4wS2KbchX6x49os=; b=pqt2PK7hksBR3mJ5kXj/PkWNCvd6CVqQ+eXEiGxRlEBHwVf1iHyVnAtd5nxjEsCYo/ LiC42AdbbhRjSRBEDFf0fQH/UMibHy0Fuwu83njKK7yeayOd5SzyBGIvwRh64NjL3MwX 6LQudTsYeclFGhERRUtUpc0NxPRb2BP+1IlEcLoGbHWqyEYCTHc+V+WfqyHb5Mtnqqfp oWDJ00aqsKQ3Yd1U463sTvrhLO/U1olit8WODkBwDf9mLEx7oGBMZLA6zDfiavvzoNkk 36pFM7h33RRYvm3mEL3zJSsNK/F63AfHnIIeVw1PnWd5F2IgrrSv12Gc9IljutbFyW44 oxyQ== X-Gm-Message-State: ACgBeo2i7w9CaM0p5ShvtT8lmcv0bvPP0/5rsBn4PL7GdDagKENJ7eRs gRoLh8ZnTt5AU/DyDm3s6MZz X-Google-Smtp-Source: AA6agR5zlETloIFr5d/fIWSZSdcKrmUSV6WYj6LsvBHhiBo/B7jXgXkxTeJ5gV0b1ZMcfAXG2BrqAA== X-Received: by 2002:a05:6870:b613:b0:10b:db5f:6026 with SMTP id cm19-20020a056870b61300b0010bdb5f6026mr3337828oab.159.1659710926618; Fri, 05 Aug 2022 07:48:46 -0700 (PDT) Received: from ?IPV6:2600:1700:e72:80a0:3928:8f07:23c6:89bf? ([2600:1700:e72:80a0:3928:8f07:23c6:89bf]) by smtp.gmail.com with ESMTPSA id y12-20020a4a650c000000b00440ed1f8c45sm717462ooc.43.2022.08.05.07.48.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Aug 2022 07:48:46 -0700 (PDT) Message-ID: Date: Fri, 5 Aug 2022 10:48:43 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] revision.c: set-up "index_state.repo", don't segfault in pack-objects Content-Language: en-US To: =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , git@vger.kernel.org Cc: Junio C Hamano , Emily Noneman , Jeff King , Paul Horn References: From: Derrick Stolee In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On 8/5/2022 10:24 AM, Ævar Arnfjörð Bjarmason wrote: > Narrowly fix a segfault that's been reported against pack-objects at > [1] and [2]. > > This fixes a segfault in "git pack-objects", see a reports at [1] and > [2]. In that case we'd go through the add_index_objects_to_pending() > codepath being modified here, and eventually call into > new_untracked_cache(). > > We'd then segfault in new_untracked_cache_flags() as we tried to use a > NULL "repo" extracted from the "struct index_state". > struct worktree *wt = *p; > - struct index_state istate = { NULL }; > + struct index_state istate = { .repo = revs->repo }; Thanks for the fix. It is definitely narrow to this particular stack trace. It is rare that we create an index that is not 'the_index' in this way. However, there are similar { NULL } initializers that could be cleaned up in these files: * apply.c * merge-recursive.c * builtin/stash.c * builtin/worktree.c Of course, delay these for a follow-up since these uses are not causing segfaults in the wild. Thanks, -Stolee