John Malmberg wrote:
Update, and I missed posting the original to the perl5-porters list.
In the module PP_SYS, routine Perl_pp_open, the pointer *tmps is being
declared const and initialized with tmps = SvPV_const(sv, len).
This routine then calls Perl_do_openn() which may modify the string,
thus causing data corruption according the how the data is declared.
A cast has been installed on the call to override the compiler
diagnosing the potential data corruption.
Either the routine Perl_pp_open needs to be modified so that the *tmps
is not a const pointer, or a copy of the string must be made either
before the call to Perl_do_openn() or by the Perl_do_openn routine so
that the *name parameter can be declared const.
I was planning on fixing it by removing the const from tmps in
Perl_pp_open, but now I have discovered that Perl_do_open() calls
Perl_do_openn() and that sometimes Perl_do_open() is called with a
constant string.
It appears that the times Perl_do_openn() is called with a pointer to a
constant string it never takes the path that modifies it, thus avoiding
the access violation.
Still, it appears that the fix must be in in Perl_do_openn(), and it
looks like what it is is to change the parameter "char * name" to be
"const char * oname" and change the references for "name" to "oname"
before "oname" is declared.
Then the declaration of "char * oname = name;" becomes "char * name:"
followed by a Newx(name, strlen(oname), char), and a strncpy() to make a
copy.
Then const qualifiers can be put on Perl_do_open(), and Perl_do_open9().
-John
[EMAIL PROTECTED]
Personal Opinion Only