From: Eric Wong Date: Tue, 2 Apr 2019 00:45:48 +0000 (+0000) Subject: viewvcs: check for premature EOF from git-cat-file X-Git-Tag: v1.2.0~351 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c1b26477f9c60338ee1ebafd7d37628692ff7332;p=public-inbox.git viewvcs: check for premature EOF from git-cat-file Not entirely sure what is causing this, but it appears to be causing infinite loops when attempting to display certain blobs. Fortunately, the fair scheduling of public-inbox-httpd prevented this from becoming a real problem aside from increasing CPU usage. --- diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm index f5374517..ae721034 100644 --- a/lib/PublicInbox/ViewVCS.pm +++ b/lib/PublicInbox/ViewVCS.pm @@ -62,6 +62,10 @@ sub stream_large_blob ($$$$) { my $ct = 'text/plain; charset=UTF-8'; return [200, ['Content-Type', $ct, @cl] ]; } + if ($r == 0) { + warn "premature EOF on $oid $$logref\n"; + return html_page($ctx, 500, $logref); + } undef; # bref keeps growing } });