Nicholas Clark wrote:
On Mon, Feb 20, 2006 at 10:12:33AM -0500, John E. Malmberg wrote:
Run a second time with tainting, and fails.

EAGLE> mcr [-]ndbgperl "-T" "-I[-.lib]" [-.t.op]taint.t2
SV = PVMG(0x2c6d00) at 0x2e9740
 REFCNT = 1
 FLAGS = (PADMY,GMG,SMG,pPOK)
 IV = 0
 NV = 0
 PV = 0x339ce0 "eagle$dqa0:[project_root.][perl-blead]ndbgperl.exe;3"\0
 CUR = 52
 LEN = 56
 MAGIC = 0x2f7850
   MG_VIRTUAL = &PL_vtbl_taint
   MG_TYPE = PERL_MAGIC_taint(t)
   MG_LEN = 1
a = eagle$dqa0:[project_root.][perl-blead]ndbgperl.exe;3
b = 5, should be 8


SV = PVMG(0x822c85c) at 0x821927c
  REFCNT = 1
  FLAGS = (GMG,SMG,pIOK,pPOK)
  IV = 3
  NV = 0
  PV = 0x826730c "/home/nick/p4perl/perl/perl"\0
  CUR = 27
  LEN = 28
  MAGIC = 0x826734c
    MG_VIRTUAL = &PL_vtbl_taint
    MG_TYPE = PERL_MAGIC_taint(t)
    MG_LEN = 1

ie the FLAGS line reads (PADMY,GMG,SMG,pIOK,pPOK)
Your FLAGS line doesn't have pIOK.

For me, the input is $^X

SV = PVMG(0x822c044) at 0x82192fc
  REFCNT = 1
  FLAGS = (GMG,SMG,pPOK)
  IV = 0
  NV = 0
  PV = 0x8216e8c "/home/nick/p4perl/perl/perl"\0
  CUR = 27
  LEN = 28
  MAGIC = 0x8216ecc
    MG_VIRTUAL = &PL_vtbl_taint
    MG_TYPE = PERL_MAGIC_taint(t)
    MG_LEN = 1

For me, $^X untainted is:

SV = PV(0x29dc00) at 0x29be58
  REFCNT = 1
  FLAGS = (POK,pPOK)
  PV = 0x2c8220 "eagle$dqa0:[project_root.][perl-blead]ndbgperl.exe;2"\0
  CUR = 52
  LEN = 56

And tainted is:

SV = PVMG(0x2c6760) at 0x29be78
  REFCNT = 1
  FLAGS = (GMG,SMG,pPOK)
  IV = 0
  NV = 0
  PV = 0x2c8240 "eagle$dqa0:[project_root.][perl-blead]ndbgperl.exe;2"\0
  CUR = 52
  LEN = 56
  MAGIC = 0x2c8280
    MG_VIRTUAL = &PL_vtbl_taint
    MG_TYPE = PERL_MAGIC_taint(t)
    MG_LEN = 1

and

SV = IV(0x8219fa8) at 0x8219fac
  REFCNT = 1
  FLAGS = (PADTMP,IOK,READONLY,pIOK)
  IV = 3


I assume that $^X is tainted on VMS?

It appears to be.


Of course I do not really understand what I am looking at :-)


Well, there should be both pPOK and pIOK flags on the the value, with
IV = 3 and PV being the string for $^X

If you change your

    print STDERR "a = $a\n";

to

    printf STDERR "a = '%s', %d\n", $a, $a;

you should see the two values of the dualvar.

This is what I get:

a = 'eagle$dqa0:[project_root.][perl-blead]ndbgperl.exe;2', 0

Assuming that input, the bug I was actually trying to fix was that when you
put this tainted dual valued scalar into an arithmetic expression, the string
got used for its numeric value, rather than the integer. Hence 0 rather than
3 in this case.

I do not seem to be getting the numeric value set.

I think adding -nolinenumbers to the flags passed to xsubpp should do it.
Although that might mean hacking descrip.mms after it's been generated from
Makefile.PL

Something for the TODO list for OpenVMS for all such modules, unless someone knows how to get the OpenVMS debugger to handle .XS files. :-)

-John
[EMAIL PROTECTED]
Personal Opinion Only

Reply via email to