From: Taylor Blau <email@example.com> To: Jeff King <firstname.lastname@example.org> Cc: email@example.com Subject: Re: [PATCH 0/6] better handling of gigantic config files Date: Sun, 12 Apr 2020 18:49:27 -0600 [thread overview] Message-ID: <20200413004927.GC55122@syl.local> (raw) In-Reply-To: <20200410194211.GA1363484@coredump.intra.peff.net> Hi Peff, On Fri, Apr 10, 2020 at 03:42:11PM -0400, Jeff King wrote: > The fact that parse_config_key() requires its callers to use an "int" > for a string length has bugged me for a while, and it re-bugged me when > looking at it today. So I finally decided to do something about it, > which led to an odyssey of other small fixes and cleanups. > > In particular, I was curious what kinds of bad behavior you could > provoke by having a key name larger than 2GB (especially because we use > the same parser for .gitmodules files, which might not be trusted). It > turns out: basically none, because the config parser chokes immediately > dues to its own int/size_t confusion. > > After patch 5, the config system _can_ actually handle stupidly-sized > config keys, but in the end I decided to explicitly disallow them. > There's downstream code that would be impossible to fix, and nobody > actually cares about this case working anyway. See patch 6 for more > discussion. I do still think the other patches are worth having as a > cleanup; the more code that is safe from unexpected integer truncation > the better. > > [1/6]: remote: drop auto-strlen behavior of make_branch() and make_rewrite() > [2/6]: parse_config_key(): return subsection len as size_t > [3/6]: config: drop useless length variable in write_pair() > [4/6]: git_config_parse_key(): return baselen as size_t > [5/6]: config: use size_t to store parsed variable baselen > [6/6]: config: reject parsing of files over INT_MAX > > archive-tar.c | 4 ++-- > builtin/help.c | 2 +- > builtin/reflog.c | 2 +- > config.c | 42 +++++++++++++++++++++++++++++------------- > config.h | 4 ++-- > convert.c | 2 +- > fsck.c | 2 +- > ll-merge.c | 2 +- > promisor-remote.c | 2 +- > remote.c | 37 +++++++++++++------------------------ > submodule-config.c | 3 ++- > userdiff.c | 4 ++-- > 12 files changed, 56 insertions(+), 50 deletions(-) > > -Peff Thanks for doing this. I knew that it rang a bell for some reason, but it was because of the upload-pack changes to limit the set of allowed object filter choices that I'd sent as an RFC somewhere. I was using 'parse_config_key()', and I think that you noted somewhere that it was odd that it filled an int and not a size_t. So, thanks very much for fixing that case. This series looks very good and straightforward to me. So, Reviewed-by: Taylor Blau <firstname.lastname@example.org> Thanks, Taylor
next prev parent reply other threads:[~2020-04-13 0:49 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-10 19:42 Jeff King 2020-04-10 19:43 ` [PATCH 1/6] remote: drop auto-strlen behavior of make_branch() and make_rewrite() Jeff King 2020-04-10 21:44 ` Junio C Hamano 2020-04-10 19:44 ` [PATCH 2/6] parse_config_key(): return subsection len as size_t Jeff King 2020-04-10 19:44 ` [PATCH 3/6] config: drop useless length variable in write_pair() Jeff King 2020-04-10 21:51 ` Junio C Hamano 2020-04-10 19:46 ` [PATCH 4/6] git_config_parse_key(): return baselen as size_t Jeff King 2020-04-10 19:47 ` [PATCH 5/6] config: use size_t to store parsed variable baselen Jeff King 2020-04-10 19:50 ` [PATCH 6/6] config: reject parsing of files over INT_MAX Jeff King 2020-04-10 22:04 ` Junio C Hamano 2020-04-10 22:15 ` Jeff King 2020-04-13 0:47 ` Taylor Blau 2020-04-13 22:14 ` Junio C Hamano 2020-04-13 0:49 ` Taylor Blau [this message] 2020-04-13 17:20 ` [PATCH 0/6] better handling of gigantic config files Jeff King 2020-04-13 17:23 ` Taylor Blau
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200413004927.GC55122@syl.local \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH 0/6] better handling of gigantic config files' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).