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);
}
}
1.500 +6 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.499
retrieving revision 1.500
diff -u -u -r1.499 -r1.500
--- Changes 25 Sep 2004 23:27:10 -0000 1.499
+++ Changes 26 Sep 2004 03:12:38 -0000 1.500
@@ -12,6 +12,12 @@
=item 1.99_17-dev
+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. [Stas]
+
make sure that each handler callback starts with a pristine
tainted-ness state, so that previous callback calls won't affect the
consequent ones. Without this change any handler triggering eval or