+
+ /* sv_magic(), when adding magic (e.g.taint magic), also
+ * recalculates any pos() magic, converting any byte offset
+ * to utf8 offset. Make sure pos() is reset before this
+ * happens rather than using the now invalid value (since
+ * we've just replaced targ's pvx buffer with the
+ * potentially shorter dstr buffer). Normally (i.e. in
+ * non-taint cases), pos() gets removed a few lines later
+ * with the SvSETMAGIC().
+ */
+ {
+ MAGIC *mg;
+ mg = mg_find_mglob(targ);
+ if (mg) {
+ MgBYTEPOS_set(mg, targ, SvPVX(targ), -1);
+ }
+ }
+