summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Constants.pm4
-rwxr-xr-xshowdependencygraph.cgi12
-rw-r--r--template/en/default/global/user-error.html.tmpl5
3 files changed, 18 insertions, 3 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index d1ca92260..c31565dd8 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -182,6 +182,7 @@ use Memoize;
MAX_FREETEXT_LENGTH
MAX_BUG_URL_LENGTH
MAX_POSSIBLE_DUPLICATES
+ MAX_WEBDOT_BUGS
PASSWORD_DIGEST_ALGORITHM
PASSWORD_SALT_LENGTH
@@ -566,6 +567,9 @@ use constant MAX_BUG_URL_LENGTH => 255;
# will return.
use constant MAX_POSSIBLE_DUPLICATES => 25;
+# Maximum number of bugs to display in a dependency graph
+use constant MAX_WEBDOT_BUGS => 2000;
+
# This is the name of the algorithm used to hash passwords before storing
# them in the database. This can be any string that is valid to pass to
# Perl's "Digest" module. Note that if you change this, it won't take
diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi
index 842b4c092..0b9825b91 100755
--- a/showdependencygraph.cgi
+++ b/showdependencygraph.cgi
@@ -44,7 +44,7 @@ my $vars = {};
# performance.
my $dbh = Bugzilla->switch_to_shadow_db();
-local our (%seen, %edgesdone, %bugtitles);
+our (%seen, %edgesdone, %bugtitles, $bug_count);
# CreateImagemap: This sub grabs a local filename as a parameter, reads the
# dot-generated image map datafile residing in that file and turns it into
@@ -91,6 +91,7 @@ sub AddLink {
if (!exists $edgesdone{$key}) {
$edgesdone{$key} = 1;
print $fh "$dependson -> $blocked\n";
+ $bug_count++;
$seen{$blocked} = 1;
$seen{$dependson} = 1;
}
@@ -123,10 +124,10 @@ chmod Bugzilla::Install::Filesystem::CGI_WRITE, $filename
my $urlbase = Bugzilla->params->{'urlbase'};
print $fh "digraph G {";
-print $fh qq{
+print $fh qq(
graph [URL="${urlbase}query.cgi", rankdir=$rankdir]
node [URL="${urlbase}show_bug.cgi?id=\\N", style=filled, color=lightgrey]
-};
+);
my %baselist;
@@ -236,6 +237,11 @@ foreach my $k (keys(%seen)) {
print $fh "}\n";
close $fh;
+if ($bug_count > MAX_WEBDOT_BUGS) {
+ unlink($filename);
+ ThrowUserError("webdot_too_large");
+}
+
my $webdotbase = Bugzilla->params->{'webdotbase'};
if ($webdotbase =~ /^https?:/) {
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index 6c1caf81d..d53708409 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -1760,6 +1760,11 @@
Sorry, but you are not allowed to (un)mark comments or attachments
as private.
+ [% ELSIF error == "webdot_too_large" %]
+ [% title = "Dependency Graph Too Large" %]
+ The dependency graph contains too many [% terms.bugs %] to display (more
+ than [% constants.MAX_WEBDOT_BUGS FILTER html %] [%+ terms.bugs %]).
+
[% ELSIF error == "wrong_token_for_cancelling_email_change" %]
[% title = "Wrong Token" %]
That token cannot be used to cancel an email address change.