From: Perl 5 Porters Date: Fri, 20 Sep 1996 19:38:57 +0000 (-0400) Subject: perl 5.003_06: sv.h X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=51594c39ec0a5df8dda24c63498418e94d9787e1;p=p5sagit%2Fp5-mst-13.2.git perl 5.003_06: sv.h Date: Thu, 19 Sep 1996 11:58:22 -0400 From: "Randy J. Ray" Subject: Patch: Untaint FH flag and clean DATA handles This patch adds a IOf_UNTAINT flag in sv.h, as one of the possibles on an xpvio->xio_flags struct member. It is used to mark the given file handle as a clean source, even when tainting is turned on. There are also patches to pp_sys.c in pp_sysread to check this flag before tainting data, and in pp_hot.c in do_readline for the same reason. Lastly, it patches toke.c to automatically set this flag on on a __DATA__ filehandle. The creation of the $pack::DATA pseudo-filehandle is already checked against running under eval, so this should not introduce any insecurity. This patch *does not*: * Add the "untaint" keyword. Date: Fri, 20 Sep 1996 15:38:57 -0400 From: Gurusamy Sarathy Subject: Re: "Attempt to free non-existent shared string"? (with patch) I found a subtle problem with the lazydelete mechanism (which is used to postpone the delete of a entry that may be getting iterated over). I was using the HeKLEN slot to hold the hint, but the real HeKLEN is needed later to call unsharepvn(). This means that only magical hash entries can use the HeKLEN slot to hold flags. Here's a tested patch against 5.00305 that fixes the problem. The patch simply moves the LAZYDEL hint to become a SV-level private flag. --- diff --git a/sv.h b/sv.h index 710664c..47a9fd3 100644 --- a/sv.h +++ b/sv.h @@ -130,6 +130,7 @@ struct io { #define SVpbm_TAIL 0x20000000 #define SVphv_SHAREKEYS 0x20000000 /* keys live on shared string table */ +#define SVphv_LAZYDEL 0x40000000 /* entry in xhv_eiter must be deleted */ #ifdef OVERLOAD #define SVpgv_AM 0x40000000 @@ -269,6 +270,7 @@ struct xpvio { #define IOf_START 2 /* check for null ARGV and substitute '-' */ #define IOf_FLUSH 4 /* this fp wants a flush after write op */ #define IOf_DIDTOP 8 /* just did top of form */ +#define IOf_UNTAINT 16 /* consider this fp (and it's data) "safe" */ /* The following macros define implementation-independent predicates on SVs. */