[Koha-bugs] [Bug 22429] Infinite loop in patron card printing
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Mar 4 07:35:31 CET 2019
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22429
--- Comment #6 from David Cook <dcook at prosentient.com.au> ---
Aha... it's the parentheses which are the problem. They're being interpreted as
regex metacharacters and not literal values!
First line: '12345678 123456 (Test) Test'
First string width: 299.775390625
First $1: ' Test'
First $trim: ''
Next line: '12345678 123456 (Test)'
Next string width: 249.94140625
Next $1: ' (Test)'
Next $trim: ' (Test) Test'
Next line: '12345678 123456 (Test)'
Next string width: 249.94140625
Next $1: ' (Test)'
Next $trim: ' (Test) (Test) Test'
And the $trim just keeps prepending (Test) over and over again.
--
Fortunately, this is a very easy solve.
I change the following
$line =~ s/$1//;
to
$line =~ s/\Q$1\E//;
And voila. It works.
I bet this sort of "regular expression injection" could bite us in other parts
of Koha...
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list