]> Sergey Matveev's repositories - public-inbox.git/commitdiff
viewvcs: check for premature EOF from git-cat-file
authorEric Wong <e@80x24.org>
Tue, 2 Apr 2019 00:45:48 +0000 (00:45 +0000)
committerEric Wong <e@80x24.org>
Tue, 2 Apr 2019 08:05:09 +0000 (08:05 +0000)
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.

lib/PublicInbox/ViewVCS.pm

index f5374517a7f12fcdf440fd3487bdc35f9e264416..ae721034b8bf07532ffc89095852eb30916afaba 100644 (file)
@@ -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
                }
        });