From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id A5E9E1F47C for ; Thu, 26 Jan 2023 11:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237265AbjAZLgF (ORCPT ); Thu, 26 Jan 2023 06:36:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236303AbjAZLgE (ORCPT ); Thu, 26 Jan 2023 06:36:04 -0500 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 103093A876 for ; Thu, 26 Jan 2023 03:36:03 -0800 (PST) Received: (qmail 20904 invoked by uid 109); 26 Jan 2023 11:36:03 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Thu, 26 Jan 2023 11:36:03 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 22918 invoked by uid 111); 26 Jan 2023 11:36:02 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Thu, 26 Jan 2023 06:36:02 -0500 Authentication-Results: peff.net; auth=none Date: Thu, 26 Jan 2023 06:36:02 -0500 From: Jeff King To: Junio C Hamano Cc: =?utf-8?B?UmVuw6k=?= Scharfe , =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Git List Subject: Re: [PATCH] tree-walk: disallow overflowing modes Message-ID: References: <230123.86a629tzgc.gmgdl@evledraar.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Jan 24, 2023 at 12:44:16PM -0800, Junio C Hamano wrote: > René Scharfe writes: > > > ... It's basically harmless. Perhaps > > we just need a comment stating that, to contain the urge to "fix" this. > > Yeah, especially since fsck finds and warns about bad mode with > FSCK_MSG_BAD_FILEMODE and also FSCK_MSG_ZERO_PADDED_FILEMODE in a > separate codepath, adding another piece of code that checks a > slightly different condition does not sound like a good idea. Yeah, I'm happy to drop this whole thing. I do think it would be reasonable for fsck to check for overflow alongside BAD_FILEMODE, etc, but it's annoying to do since we are relying on the existing parser. I actually have a suspicion that it might be reasonable for fsck to just parse the trees itself, rather than relying on decode_tree_entry(), etc. But that's a much bigger topic (and a possible maintenance burden) for questionable gain, so unless we find some compelling reason (some case that we really want to detect but which we want the regular decoder to ignore), it's probably not worth exploring. -Peff