New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$1 suddenly tainted after regexp on utf-8 string #9102
Comments
From dst@heise.deThis is a bug report for perl from dst@heise.de, After applying a regex using \S on a string which is flagged as utf-8 #!/usr/bin/perl -T use warnings; my $line = 'A'; __END__ $first is unexpectedly tainted. If you comment out the line which The behaviour is identical on a self-built perl5.9.5. Flags: Site configuration information for perl v5.8.8: Configured by Debian Project at Wed Dec 6 23:17:41 UTC 2006. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Locally applied patches: @INC for perl v5.8.8: Environment for perl v5.8.8: |
From @nwc10On Tue, Nov 06, 2007 at 07:38:36AM -0800, dst @ heise. de wrote:
It's in still in blead. I thought that it was something to do with the swash $ cat 47195.pl my __END__ But it doesn't seem to be, because if I change the program to be a loop: $ cat 47195.pl __END__ the results change. (Correct output would be "untainted" both times) Certainly, the solution isn't this simple: $ p4 diff Inline Patch--- /tmp/tmp.59321.0 Tue Nov 6 15:55:47 2007
+++ /home/nick/p4perl/perl/regcomp.c Tue Nov 6 15:54:11 2007
@@ -9627,7 +9627,10 @@ Perl_save_re_context(pTHX)
struct re_save_state *state;
SAVEVPTR(PL_curcop);
- SSGROW(SAVESTACK_ALLOC_FOR_RE_SAVE_STATE + 1);
+ /* Add 3 for the save bool, and do the check in one to avoid a possible
+ second reallocation. */
+ SSGROW(SAVESTACK_ALLOC_FOR_RE_SAVE_STATE + 1 + 3);
+ SAVEBOOL(PL_tainted);
state = (struct re_save_state *)(PL_savestack + PL_savestack_ix);
PL_savestack_ix += SAVESTACK_ALLOC_FOR_RE_SAVE_STATE;
Nicholas Clark |
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10use more 'coffee'; On Tue, Nov 06, 2007 at 03:59:01PM +0000, Nicholas Clark wrote:
Then I had to change shift, which I didn't realise I'd not done in the first Therefore, it's nothing to do with the swatch *loading* code. Nicholas Clark |
From @hvdsNicholas Clark <nick@ccl4.org> wrote: Is it because of the way multiple magic is handled, by hiding the first Hugo |
From rick@bort.caOn Nov 06 2007, dst@heise.de wrote:
Attached patch fixes this. I had a look through the rest of the switch case NDIGIT: Case LNBREAK was added with change 31026 which looks like it may have http://public.activestate.com/cgi-bin/perlbrowse/p/31026 -- |
From rick@bort.ca47195.patchdiff -pruN perl-current/regexec.c perl-current-dev/regexec.c
--- perl-current/regexec.c 2007-08-30 09:49:59.000000000 -0400
+++ perl-current-dev/regexec.c 2007-11-06 17:49:04.000000000 -0500
@@ -5405,8 +5405,8 @@ S_regrepeat(pTHX_ const regexp *prog, co
} else {
while (scan < loceol && !isSPACE(*scan))
scan++;
- break;
}
+ break;
case NSPACEL:
PL_reg_flags |= RF_tainted;
if (do_utf8) {
|
From @nwc10On Tue, Nov 06, 2007 at 07:18:45PM -0500, Rick Delaney wrote:
Thanks, applied (change 32236)
At first I assume that I can't make a regression test that shows a problem on But something is niggling me that it ought to be possible to expose this one Nicholas Clark |
From @demerphq2007/11/7 Rick Delaney <rick@bort.ca>:
I think there was only the one missing break, which your patch fixed. Sorry about that, and thanks, -- |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#47195 (status was 'resolved')
Searchable as RT47195$
The text was updated successfully, but these errors were encountered: