[PATCH v2] revision.c: fix possible null pointer access
mark_tree_uninteresting dereferences a tree pointer before checking if the pointer is valid. Fix that by doing the check first. Signed-off-by: Stefan Naewe <stefan.na...@gmail.com> --- revision.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/revision.c b/revision.c index 0fbb684..8c569cc 100644 --- a/revision.c +++ b/revision.c @@ -135,10 +135,12 @@ static void mark_tree_contents_uninteresting(struct tree *tree) void mark_tree_uninteresting(struct tree *tree) { - struct object *obj = >object; + struct object *obj; if (!tree) return; + + obj = >object; if (obj->flags & UNINTERESTING) return; obj->flags |= UNINTERESTING; -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] revision.c: fix possible null pointer access
Two functions dereference a tree pointer before checking if the pointer is valid. Fix that by doing the check first. Signed-off-by: Stefan Naewe <stefan.na...@gmail.com> --- This has been reported through the CppHints newsletter (http://cpphints.com/hints/40) but doesn't seem to have made its way to the ones who care (the git list that is...) revision.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/revision.c b/revision.c index 0fbb684..bb40179 100644 --- a/revision.c +++ b/revision.c @@ -104,7 +104,12 @@ static void mark_tree_contents_uninteresting(struct tree *tree) { struct tree_desc desc; struct name_entry entry; - struct object *obj = >object; + struct object *obj; + + if (!tree) + return; + + obj = >object; if (!has_sha1_file(obj->sha1)) return; @@ -135,10 +140,13 @@ static void mark_tree_contents_uninteresting(struct tree *tree) void mark_tree_uninteresting(struct tree *tree) { - struct object *obj = >object; + struct object *obj; if (!tree) return; + + obj = >object; + if (obj->flags & UNINTERESTING) return; obj->flags |= UNINTERESTING; -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] revision.c: fix possible null pointer access
On Thu, Dec 3, 2015 at 9:06 PM, Junio C Hamano <gits...@pobox.com> wrote: > > Stefan Naewe <stefan.na...@gmail.com> writes: > > > Two functions dereference a tree pointer before checking > > Reading them a bit carefully, a reader would notice that they > actually do not dereference the pointer at all. It just computes > another pointer and that is done by adding the offset of object > member in the tree struct. > > > if the pointer is valid. Fix that by doing the check first. > > > > Signed-off-by: Stefan Naewe <stefan.na...@gmail.com> > > --- > > This has been reported through the CppHints newsletter > > (http://cpphints.com/hints/40) > > but doesn't seem to have made its way to the ones who care (the git list > > that is...) > > Nobody would be surprised, unless the newsletter was sent to this > list, which I do not think it was (but if it was sent while I was > away, then it is very possible that I didn't see it). > > > revision.c | 12 ++-- > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/revision.c b/revision.c > > index 0fbb684..bb40179 100644 > > --- a/revision.c > > +++ b/revision.c > > @@ -104,7 +104,12 @@ static void mark_tree_contents_uninteresting(struct > > tree *tree) > > { > > struct tree_desc desc; > > struct name_entry entry; > > - struct object *obj = >object; > > + struct object *obj; > > + > > + if (!tree) > > + return; > > + > > + obj = >object; > > This is questionable; if you check all the callers of this function > (there are two of them, I think), you would notice that they both > know that tree cannot be NULL here. OK. > > > > > if (!has_sha1_file(obj->sha1)) > > return; > > @@ -135,10 +140,13 @@ static void mark_tree_contents_uninteresting(struct > > tree *tree) > > > > void mark_tree_uninteresting(struct tree *tree) > > { > > - struct object *obj = >object; > > + struct object *obj; > > > > if (!tree) > > return; > > + > > + obj = >object; > > + > > if (obj->flags & UNINTERESTING) > > return; > > This one is not wrong per-se, but an unnecessary change, because no > deferencing is involved. But 'tree->object' is dereferencing tree, isn't it ? Like '(*tree).object'. ?? > At least, please lose the blank line after > the new assignment. Will do, if you want this patch at all. > > obj->flags |= UNINTERESTING; > > Thanks. Thanks, Stefan -- python -c "print '73746566616e2e6e6165776540676d61696c2e636f6d'.decode('hex')" -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] RelNotes/1.8.1.5: mention correct 'Fixes since'
RelNotes/1.8.1.5.txt mentions 'Fixes since v1.8.1.5' which should obviously be empty. This fixes it. Signed-off-by: Stefan Naewe stefan.na...@gmail.com --- Documentation/RelNotes/1.8.1.5.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/RelNotes/1.8.1.5.txt b/Documentation/RelNotes/1.8.1.5.txt index 92da6b2..0fb94a9 100644 --- a/Documentation/RelNotes/1.8.1.5.txt +++ b/Documentation/RelNotes/1.8.1.5.txt @@ -1,7 +1,7 @@ Git 1.8.1.5 Release Notes = -Fixes since v1.8.1.5 +Fixes since v1.8.1.4 * git apply --summary has been taught to make sure the similarity -- 1.8.1.msysgit.1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ls-remote: document the '--get-url' option
While looking for a way to expand the URL of a remote that uses a 'url.name.insteadOf' config option I stumbled over the undocumented '--get-url' option of 'git ls-remote'. This adds some minimum documentation for that option. And while at it, also add that option to the '-h' output. Signed-off-by: Stefan Naewe stefan.na...@gmail.com --- Documentation/git-ls-remote.txt | 4 builtin/ls-remote.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt index 7a9b86a..a2ebf1d 100644 --- a/Documentation/git-ls-remote.txt +++ b/Documentation/git-ls-remote.txt @@ -42,6 +42,10 @@ OPTIONS it successfully talked with the remote repository, whether it found any matching refs. +--get-url:: + Expand the URL of the given remote repository taking into account any + url.base.insteadOf config setting (See linkgit:git-config[1]). + repository:: Location of the repository. The shorthand defined in $GIT_DIR/branches/ can be used. Use . (dot) to list references in diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 41c88a9..25e83cf 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -5,7 +5,7 @@ static const char ls_remote_usage[] = git ls-remote [--heads] [--tags] [-u exec | --upload-pack exec]\n - [-q|--quiet] [--exit-code] [repository [refs...]]; + [-q|--quiet] [--exit-code] [--get-url] [repository [refs...]]; /* * Is there one among the list of patterns that match the tail part -- 1.7.12 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ls-remote: document the '--get-url' option
On Fri, Sep 7, 2012 at 10:28 AM, Andreas Schwab sch...@linux-m68k.org wrote: Stefan Naewe stefan.na...@gmail.com writes: +--get-url:: + Expand the URL of the given remote repository taking into account any + url.base.insteadOf config setting (See linkgit:git-config[1]). This should probably also mention that it suppresses the normal output. Like this: http://cloud.github.com/downloads/snaewe/git/git-ls-remote.html (I also added a simple example. I'll create a new patch if it's OK) (I wonder why this isn't a subcommand of git remote.) Good question... Stefan -- python -c print '73746566616e2e6e6165776540676d61696c2e636f6d'.decode('hex') -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ls-remote: document the '--get-url' option
While looking for a way to expand the URL of a remote that uses a 'url.name.insteadOf' config option I stumbled over the undocumented '--get-url' option of 'git ls-remote'. This adds some minimum documentation for that option. Signed-off-by: Stefan Naewe stefan.na...@gmail.com --- Documentation/git-ls-remote.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt index 7a9b86a..5819ead 100644 --- a/Documentation/git-ls-remote.txt +++ b/Documentation/git-ls-remote.txt @@ -42,6 +42,10 @@ OPTIONS it successfully talked with the remote repository, whether it found any matching refs. +--get-url:: + Expand the URL of the given remote repository taking into account any + url.base.insteadOf config setting (See linkgit:git-config[1]). + repository:: Location of the repository. The shorthand defined in $GIT_DIR/branches/ can be used. Use . (dot) to list references in -- 1.7.12 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] Add a new email notification script to contrib
On Sat, Jul 14, 2012 at 12:37 PM, Tay Ray Chuan rcta...@gmail.com wrote: Hi Stefan, On Sat, Jul 14, 2012 at 5:46 PM, Stefan Näwe stefan.na...@gmail.com wrote: Do you have a fork of git.git somewhere that contains the script? (I find it so much easier these days to simply fetch another repo instead of applying patches with 'git am'.) you can try Show Original in gmail's interface and saving the text file, then running git am directly on it. Old gits used to have problems with the leading newline, but I don't see this problem nowadays. If I only would be subscribed to gitlist with my gmail account... Anyways, there's a nice script in msysgit.git [1] that makes applying patches from gmane pretty easy. Thanks Dscho! Stefan [1] https://github.com/msysgit/msysgit/blob/devel/bin/apply-from-gmane.sh -- python -c print '73746566616e2e6e6165776540676d61696c2e636f6d'.decode('hex') -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html