[EMAIL PROTECTED] wrote:
stas        2004/09/25 20:12:38

Modified: src/modules/perl modperl_callback.c
. Changes
Log:
if some code changes the current interpreter's tainted state to on,
the return value from the handler callback will be tainted, and we
fail to deal with that. So revert to coercing any return value, but
undef (a special case for exit()). to IV, so that tainted values are
handled correctly as well.
Revision Changes Path
1.77 +2 -17 modperl-2.0/src/modules/perl/modperl_callback.c
Index: modperl_callback.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -u -r1.76 -r1.77
--- modperl_callback.c 25 Sep 2004 23:27:10 -0000 1.76
+++ modperl_callback.c 26 Sep 2004 03:12:38 -0000 1.77
@@ -122,28 +122,13 @@
else {
SV *status_sv = POPs;
- if (SvIOK(status_sv)) {
- /* normal IV return (e.g., Apache::OK) */
- status = SvIVX(status_sv);
- }
- else if (status_sv == &PL_sv_undef) {
+ if (status_sv == &PL_sv_undef) {
/* ModPerl::Util::exit() and Perl_croak internally
* arrange to return PL_sv_undef with G_EVAL|G_SCALAR */
status = OK; }
- else if (SvPOK(status_sv)) {
- /* PV return that ought to be treated as IV ("0") */
- status = SvIVx(status_sv);
- MP_TRACE_h(MP_FUNC,
- "coercing handler %s's return value '%s' into %d",
- handler->name, SvPV_nolen(status_sv), status);
- }
else {
- /* any other return types are considered as errors */
- status = HTTP_INTERNAL_SERVER_ERROR;
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
- "handler %s didn't return a valid return value!",
- handler->name);
+ status = SvIVx(status_sv);
}
}

I know that I've undone some special cases, replacing it with the simple coercing of any return value into IV, but this was needed to solve the problem when a return value was tainted. I couldn't find a better solution at the moment, and didn't want to leave the failing test suite in the current cvs. We can revert it later, when a better solution is found. For example we could do the coercing only if the variable is tainted?


You can reproduce the problem with plain 'make test' or this shorter sequence (of course after undoing this change):

t/TEST -maxclients 1 -conf
t/TEST -v t/filter/in_error t/filter/out_bbs_filebucket.t

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to