* [PATCH] Fix git-fsck-cache segfault on invalid tag
@ 2005-05-20 7:00 Frank Sorenson
2005-05-20 8:50 ` Petr Baudis
0 siblings, 1 reply; 4+ messages in thread
From: Frank Sorenson @ 2005-05-20 7:00 UTC (permalink / raw)
To: Git Mailing List, Linus Torvalds
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
git-fsck-cache will segfault if a tag contains a non-existent sha1. This
patch fixes fsck-cache to report the invalid tag and not die.
- ---
commit a6a237ee3f3d2f5d76499b8f32f58057c9b4cd2d
tree ac5d65a040c22194ddcd0706dc5f0b8bb52aef65
parent 5cd4c7b7686d334e341b21d92449349feda3ef65
author Frank Sorenson <frank@tuxrocks.com> Fri, 20 May 2005 00:52:59 -0600
committer Frank Sorenson <frank@tuxrocks.com> Fri, 20 May 2005 00:52:59 -0600
fsck-cache.c | 4 ++++
1 files changed, 4 insertions(+)
Index: fsck-cache.c
===================================================================
- --- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/fsck-cache.c (mode:100644)
+++ ac5d65a040c22194ddcd0706dc5f0b8bb52aef65/fsck-cache.c (mode:100644)
@@ -315,6 +315,10 @@
return;
obj = lookup_object(sha1);
+ if (!obj) {
+ fprintf(stderr, "invalid tag %s - %s\n", path, hexname);
+ return;
+ }
obj->used = 1;
mark_reachable(obj, REACHABLE);
}
Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCjYsZaI0dwg4A47wRAn2PAJ9hyoev3stnaN0Qn2wWlBJEKiucQACgvT9Z
rVazYmUFj3nXvJDYaBoSRsM=
=KbSv
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Fix git-fsck-cache segfault on invalid tag
2005-05-20 7:00 [PATCH] Fix git-fsck-cache segfault on invalid tag Frank Sorenson
@ 2005-05-20 8:50 ` Petr Baudis
2005-05-20 13:58 ` Junio C Hamano
2005-05-20 14:36 ` Frank Sorenson
0 siblings, 2 replies; 4+ messages in thread
From: Petr Baudis @ 2005-05-20 8:50 UTC (permalink / raw)
To: Frank Sorenson; +Cc: Git Mailing List, Linus Torvalds
Dear diary, on Fri, May 20, 2005 at 09:00:41AM CEST, I got a letter
where Frank Sorenson <frank@tuxrocks.com> told me that...
> git-fsck-cache will segfault if a tag contains a non-existent sha1. This
> patch fixes fsck-cache to report the invalid tag and not die.
Oh. I've fixed this too but didn't even get to commit it yet. :-)
> Index: fsck-cache.c
> ===================================================================
> --- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/fsck-cache.c (mode:100644)
> +++ ac5d65a040c22194ddcd0706dc5f0b8bb52aef65/fsck-cache.c (mode:100644)
> @@ -315,6 +315,10 @@
> return;
>
> obj = lookup_object(sha1);
> + if (!obj) {
> + fprintf(stderr, "invalid tag %s - %s\n", path, hexname);
> + return;
> + }
> obj->used = 1;
> mark_reachable(obj, REACHABLE);
> }
My error message is
error("%s: invalid sha1 pointer %.40s", path, hexname);
I'd prefer that (at least use the error() call). The .40 is there since
it has a newline on its own.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Fix git-fsck-cache segfault on invalid tag
2005-05-20 8:50 ` Petr Baudis
@ 2005-05-20 13:58 ` Junio C Hamano
2005-05-20 14:36 ` Frank Sorenson
1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2005-05-20 13:58 UTC (permalink / raw)
To: Petr Baudis; +Cc: Frank Sorenson, Git Mailing List, Linus Torvalds
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
>> obj = lookup_object(sha1);
>> + if (!obj) {
>> + fprintf(stderr, "invalid tag %s - %s\n", path, hexname);
>> + return;
>> + }
>> ...
PB> My error message is
PB> error("%s: invalid sha1 pointer %.40s", path, hexname);
PB> I'd prefer that (at least use the error() call).
Ack.
I was about to say "doesn't lookup_object() give its own error
message before you say that, though?" because I remembered a
comment to that effect around ll 410 that gets the heads from
the command line argument, and then looked at lookup_object()
implementation to find that it does _not_ give error message.
So if you are going to do this, would you mind giving similar
error message to that command line heads stuff while you are at
it, please?
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Fix git-fsck-cache segfault on invalid tag
2005-05-20 8:50 ` Petr Baudis
2005-05-20 13:58 ` Junio C Hamano
@ 2005-05-20 14:36 ` Frank Sorenson
1 sibling, 0 replies; 4+ messages in thread
From: Frank Sorenson @ 2005-05-20 14:36 UTC (permalink / raw)
To: Petr Baudis; +Cc: Git Mailing List, Linus Torvalds
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Petr Baudis wrote:
> Dear diary, on Fri, May 20, 2005 at 09:00:41AM CEST, I got a letter
> where Frank Sorenson <frank@tuxrocks.com> told me that...
>
>>git-fsck-cache will segfault if a tag contains a non-existent sha1. This
>>patch fixes fsck-cache to report the invalid tag and not die.
>
>
> Oh. I've fixed this too but didn't even get to commit it yet. :-)
Okay. At least we fixed the same bug. It was a good exercise for me to
track it down anyway :)
> My error message is
>
> error("%s: invalid sha1 pointer %.40s", path, hexname);
>
> I'd prefer that (at least use the error() call). The .40 is there since
> it has a newline on its own.
Great. Your message looks fine. It looks like error() should work fine
as well.
Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCjfXgaI0dwg4A47wRAikrAKCvPmZBQK34sdnnY61/meuewu2jzQCfT7Qf
TDSNgfp3WBJOTvWG5uhwX4s=
=CUF2
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-20 14:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-20 7:00 [PATCH] Fix git-fsck-cache segfault on invalid tag Frank Sorenson
2005-05-20 8:50 ` Petr Baudis
2005-05-20 13:58 ` Junio C Hamano
2005-05-20 14:36 ` Frank Sorenson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.