From d166a2ff407f4498766fbde0017a763e9bf81d9f Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Sun, 29 Jun 2008 17:38:03 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20441921:=20context=3Dfile=20fails=20due=20?= =?UTF-8?q?to=20taint=20issues=20in=20file=20names=20and=20file=20rev=20nu?= =?UTF-8?q?mbers=20-=20Patch=20by=20Fr=C3=83=C2=A9d=C3=83=C2=A9ric=20Bucli?= =?UTF-8?q?n=20=20r=3Dhimorin=20a=3DLpSolit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@252681 18797224-902f-48f8-a5cc-f745e15eee43 --- .../bugzilla/Bugzilla/Attachment/PatchReader.pm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Attachment/PatchReader.pm b/mozilla/webtools/bugzilla/Bugzilla/Attachment/PatchReader.pm index 44193ed860d..cfc7610f402 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Attachment/PatchReader.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Attachment/PatchReader.pm @@ -23,8 +23,6 @@ use Bugzilla::Error; use Bugzilla::Attachment; use Bugzilla::Util; -use Encode; - sub process_diff { my ($attachment, $format, $context) = @_; my $dbh = Bugzilla->dbh; @@ -78,9 +76,9 @@ sub process_diff { setup_template_patch_reader($last_reader, $format, $context, $vars); # The patch is going to be displayed in a HTML page and if the utf8 # param is enabled, we have to encode attachment data as utf8. - # Encode::decode() knows what to do with invalid characters. if (Bugzilla->params->{'utf8'}) { - $attachment->{data} = Encode::decode_utf8($attachment->data); + $attachment->data; # Populate ->{data} + utf8::decode($attachment->{data}); } $reader->iterate_string('Attachment ' . $attachment->id, $attachment->data); } @@ -94,10 +92,11 @@ sub process_interdiff { # Encode attachment data as utf8 if it's going to be displayed in a HTML # page using the UTF-8 encoding. - # Encode::decode() knows what to do with invalid characters. if ($format ne 'raw' && Bugzilla->params->{'utf8'}) { - $old_attachment->{data} = Encode::decode_utf8($old_attachment->data); - $new_attachment->{data} = Encode::decode_utf8($new_attachment->data); + $old_attachment->data; # Populate ->{data} + utf8::decode($old_attachment->{data}); + $new_attachment->data; # Populate ->{data} + utf8::decode($new_attachment->{data}); } # Get old patch data.