Bugzilla – Attachment 85972 Details for
Bug 22429
Infinite loop in patron card printing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22429: Infinite loop in patron card printing
Bug-22429-Infinite-loop-in-patron-card-printing.patch (text/plain), 1.89 KB, created by
David Cook
on 2019-03-04 06:53:23 UTC
(
hide
)
Description:
Bug 22429: Infinite loop in patron card printing
Filename:
MIME Type:
Creator:
David Cook
Created:
2019-03-04 06:53:23 UTC
Size:
1.89 KB
patch
obsolete
>From 66aa9c7f415049e261ee48f400d6d9dd183ea51d Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 4 Mar 2019 17:43:29 +1100 >Subject: [PATCH] Bug 22429: Infinite loop in patron card printing > >Text fields in Patron Card Text Layouts can contain regular >expression metacharacters, which - instead of being treated as >literal values - are interpreted and prevent line wrapping. This >causes the process to get stuck in an infinite loop, which keeps >running even after the web server has timed out (at least when >using CGI). > >This patch escapes the relevant input from the text field so the >regular expression substitution treats characters as literals >instead of as metacharacters. >--- > C4/Patroncards/Patroncard.pm | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/C4/Patroncards/Patroncard.pm b/C4/Patroncards/Patroncard.pm >index 559d10d921..661a9e8ac5 100644 >--- a/C4/Patroncards/Patroncard.pm >+++ b/C4/Patroncards/Patroncard.pm >@@ -260,7 +260,8 @@ sub draw_text { > $line =~ m/^.*(\s.*\s*|\s&|\<.*\>)$/; > warn sprintf('Line wrap failed. DEBUG INFO: Data: \'%s\'\n Method: C4::Patroncards->draw_text Additional Information: Line wrap regexp failed. (Please file in this information in a bug report at http://bugs.koha-community.org', $line) and last WRAP_LINES if !$1; > $trim = $1 . $trim; >- $line =~ s/$1//; >+ #Sanitize the input into this regular expression so regex metacharacters are escaped as literal values (https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22429) >+ $line =~ s/\Q$1\E//; > $string_width = C4::Creators::PDF->StrWidth($line, $text_attribs->{'font'}, $text_attribs->{'font_size'}); > # $font_units_width = $m->string_width($line); > # $string_width = ($font_units_width * $text_attribs->{'font_size'}) / $units_per_em; >-- >2.16.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22429
:
85972
|
86520