]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 793893: Tabular reports crash when no format parameter is defined
authorFrédéric Buclin <LpSolit@gmail.com>
Sat, 29 Sep 2012 11:29:52 +0000 (13:29 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Sat, 29 Sep 2012 11:29:52 +0000 (13:29 +0200)
r=glob a=LpSolit

report.cgi
template/en/default/filterexceptions.pl
template/en/default/reports/report.html.tmpl

index a5d170825e264b37149ba764ce6c493e967352db..5c7ec870b0e053183492259e0311809292741a6e 100755 (executable)
@@ -117,10 +117,12 @@ $width <= 2000 || ThrowUserError("chart_too_large");
   || ThrowCodeError("invalid_dimensions");
 $height <= 2000 || ThrowUserError("chart_too_large");
 
+my $formatparam = $cgi->param('format') || '';
+
 # These shenanigans are necessary to make sure that both vertical and 
 # horizontal 1D tables convert to the correct dimension when you ask to
 # display them as some sort of chart.
-if (defined $cgi->param('format') && $cgi->param('format') eq "table") {
+if ($formatparam eq "table") {
     if ($col_field && !$row_field) {    
         # 1D *tables* should be displayed vertically (with a row_field only)
         $row_field = $col_field;
@@ -243,7 +245,7 @@ $vars->{'row_names'} = \@row_names;
 $vars->{'tbl_names'} = \@tbl_names;
 
 # Below a certain width, we don't see any bars, so there needs to be a minimum.
-if ($cgi->param('format') eq "bar") {
+if ($formatparam eq "bar") {
     my $min_width = (scalar(@col_names) || 1) * 20;
 
     if (!$cgi->param('cumulate')) {
@@ -259,8 +261,6 @@ $vars->{'query'} = $query;
 $vars->{'saved_report_id'} = $cgi->param('saved_report_id');
 $vars->{'debug'} = $cgi->param('debug');
 
-my $formatparam = $cgi->param('format');
-
 if ($action eq "wrap") {
     # So which template are we using? If action is "wrap", we will be using
     # no format (it gets passed through to be the format of the actual data),
@@ -269,7 +269,6 @@ if ($action eq "wrap") {
     # data, or images generated by calling report.cgi again with action as
     # "plot".
     $formatparam =~ s/[^a-zA-Z\-]//g;
-    trick_taint($formatparam);
     $vars->{'format'} = $formatparam;
     $formatparam = '';
 
index 7eb9cf6f079fe7b7accbac2301d0d41e0eaa3980..00ae28f08598b3377fcfcc2b1ddc3fb883d2e63b 100644 (file)
@@ -90,7 +90,6 @@
   'formaturl', 
   'other_format.name', 
   'switchbase',
-  'format',
   'cumulate',
 ],
 
index 8219ebd89fb82b94a737a9ccc3b93bd33f660f02..8dc4bc5a71107489ca192df055e802d55801ab6c 100644 (file)
           <a href="query.cgi?[% switchbase %]&amp;format=report-table">Edit this report</a>
         [% ELSE %]
           <a href="query.cgi?[% switchbase %]&amp;chart_format=
-                  [%~ format %]&amp;format=report-graph&amp;cumulate=[% cumulate %]">
+                  [%~ format FILTER uri %]&amp;format=report-graph&amp;cumulate=[% cumulate %]">
           Edit this report</a>
         [% END %]
       </td>
         [% ELSE %]
           <form method="get" action="report.cgi">
             <input type="submit" id="remember" value="Remember report"> as
-            <input type="hidden" name="query" value="[% switchbase %]&amp;format=[% format FILTER html %]&amp;action=wrap">
+            <input type="hidden" name="query" value="[% switchbase %]&amp;format=[% format FILTER uri %]&amp;action=wrap">
             <input type="hidden" name="action" value="add">
             <input type="hidden" name="token" value="[% issue_hash_token(['save_report']) FILTER html %]">
             <input type="text" id="name" name="name" size="20" value="" maxlength="64">