Skip Menu |

This queue is for tickets about the Curses-UI-Grid CPAN distribution.

Report information
The Basics
Id: 128947
Status: new
Priority: 0/
Queue: Curses-UI-Grid

People
Owner: Nobody in particular
Requestors: lhalmagyi [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Curses::UI::Grid::Cell v0.14 // Error: substr outside of string // SLES11/12 // perl v5.10 and above
Date: Wed, 27 Mar 2019 11:44:12 +0100
To: bug-Curses-UI-Grid [...] rt.cpan.org
From: Lóránt Halmágyi <lhalmagyi [...] gmail.com>
Related module versions: Curses::UI::Grid v0.15 Curses::UI::Grid::Cell v0.14 Dear Madam, Dear Sir, This reported BUG seems to be OS independent and uncritical. We get `substr outside of string' error message, when text in a cell is scrolled so much to the right after the cell string, that only blanks are shown. For instance: BEFORE: As on screenshots below, by scrolling to the right within Password cell, last 2 characters of a Password Hash are shown and no error message is shown: [image: image.png] AFTER: As no limit for scrolling is set, when scrolling additional 2 characters to the right - thus just blanks are shown in the Cell - , following error message appears: [image: image.png] Related code line: $text = substr($text, -$this->xoffset, $current_width); KR, Lorant
Download image.png
image/png 1.3k
image.png
Download image.png
image/png 4k
image.png
Subject: [rt.cpan.org #128947]: quick fix solution proposal
Date: Tue, 9 Apr 2019 09:25:44 +0200
To: bug-Curses-UI-Grid [...] rt.cpan.org
From: Lóránt Halmágyi <lhalmagyi [...] gmail.com>
Dear Madam, Dear Sir, I did not check, if the same problem exists scrolling outside of text length to the left (we currently don't need it), but here is a small, quick fix proposal in unified diff: --- /home/qxk5848/usermgmt/.usermgmt2_files/Curses/UI/Grid/Cell.pm 2019-04-08 12:28:37.000000000 +0200 +++ /global/instserv/bin/.usermgmt2_files/Curses/UI/Grid/Cell.pm 2019-04-04 10:34:59.000000000 +0200 @@ -118,12 +118,7 @@ } if($alignlign eq 'L' && abs($this->xoffset)) { - if (abs($this->xoffset) < ($text_length + 1)) { - $text = substr($text, -$this->xoffset, $current_width); - } - else { - $text = substr($text, ($text_length), $current_width); - } + $text = substr($text, -$this->xoffset, $current_width); } $text = sprintf("%".(($alignlign || '') eq 'L' ? "-":"") . $width . "s", ($text ||'')); @@ -780,4 +775,4 @@ =cut -1; +1; \ No newline at end of file OR via screenshot (see attachment): [image: SnapCrab_NoName_2019-4-9_8-56-44_No-00.png] KR, Lorant
SnapCrab_NoName_2019-4-9_8-56-44_No-00.png