git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Gal <gal@uci.edu>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [PATH] fix segfault in fsck-cache
Date: Sat, 23 Apr 2005 22:05:44 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0504232202380.7195@sam.ics.uci.edu> (raw)
In-Reply-To: <Pine.LNX.4.58.0504232153500.15879@ppc970.osdl.org>


I somehow got some corrupted object files in my repository that zlib 
refuses to decompress. This patch makes sure we abort early before the 
memcpy a few lines downtream segfaults (due to total_out == 0).

Andreas

Signed-off-by: Andreas Gal <gal@uci.edu>

--- 66308ede85c2dad6b184fb74a7215b06a173d8f7/sha1_file.c
+++ sha1_file.c
@@ -155,6 +155,8 @@
 
 	inflateInit(&stream);
 	ret = inflate(&stream, 0);
+	if (ret != Z_OK)
+		return NULL;
 	if (sscanf(buffer, "%10s %lu", type, size) != 2)
 		return NULL;
 


  parent reply	other threads:[~2005-04-24  5:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-23 18:22 [PATCH] make file merging respect permissions James Bottomley
2005-04-23 20:17 ` Linus Torvalds
2005-04-23 20:37   ` James Bottomley
2005-04-23 21:44   ` James Bottomley
2005-04-23 23:02     ` Petr Baudis
2005-04-23 23:09       ` James Bottomley
2005-04-23 23:21       ` James Bottomley
2005-04-24  1:01         ` Linus Torvalds
2005-04-24  4:42           ` James Bottomley
2005-04-24  4:55             ` Linus Torvalds
2005-04-24  5:03               ` James Bottomley
2005-04-24  5:05               ` Andreas Gal [this message]
2005-04-24  5:24                 ` [PATH] fix segfault in fsck-cache Andreas Gal
2005-04-24 12:46               ` [PATCH] make file merging respect permissions James Bottomley

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0504232202380.7195@sam.ics.uci.edu \
    --to=gal@uci.edu \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).