diff options
Diffstat (limited to 'lang/perl5/patches/patch-da')
-rw-r--r-- | lang/perl5/patches/patch-da | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/lang/perl5/patches/patch-da b/lang/perl5/patches/patch-da deleted file mode 100644 index fbcaca6b805..00000000000 --- a/lang/perl5/patches/patch-da +++ /dev/null @@ -1,150 +0,0 @@ -$NetBSD: patch-da,v 1.2 2008/06/01 22:04:07 he Exp $ - -Fix for -http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1927 -from -http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=26;filename=27_fix_regcomp_utf8;att=1;bug=454792 - ---- regcomp.c.orig 2008-06-01 22:04:17.000000000 +0200 -+++ regcomp.c -@@ -2790,6 +2790,39 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta - } - - /* -+ * reg_recode -+ * -+ * It returns the code point in utf8 for the value in *encp. -+ * value: a code value in the source encoding -+ * encp: a pointer to an Encode object -+ * -+ * If the result from Encode is not a single character, -+ * it returns U+FFFD (Replacement character) and sets *encp to NULL. -+ */ -+STATIC UV -+S_reg_recode(pTHX_ const char value, SV **encp) -+{ -+ STRLEN numlen = 1; -+ SV * const sv = sv_2mortal(newSVpvn(&value, numlen)); -+ const char * const s = encp && *encp ? sv_recode_to_utf8(sv, *encp) -+ : SvPVX(sv); -+ const STRLEN newlen = SvCUR(sv); -+ UV uv = UNICODE_REPLACEMENT; -+ -+ if (newlen) -+ uv = SvUTF8(sv) -+ ? utf8n_to_uvchr((U8*)s, newlen, &numlen, UTF8_ALLOW_DEFAULT) -+ : *(U8*)s; -+ -+ if (!newlen || numlen != newlen) { -+ uv = UNICODE_REPLACEMENT; -+ if (encp) -+ *encp = NULL; -+ } -+ return uv; -+} -+ -+/* - - regatom - the lowest level - * - * Optimization: gobbles an entire sequence of ordinary characters so that -@@ -3181,6 +3214,8 @@ tryagain: - ender = grok_hex(p, &numlen, &flags, NULL); - p += numlen; - } -+ if (PL_encoding && ender < 0x100) -+ goto recode_encoding; - break; - case 'c': - p++; -@@ -3200,6 +3235,17 @@ tryagain: - --p; - goto loopdone; - } -+ if (PL_encoding && ender < 0x100) -+ goto recode_encoding; -+ break; -+ recode_encoding: -+ { -+ SV* enc = PL_encoding; -+ ender = reg_recode((const char)(U8)ender, &enc); -+ if (!enc && SIZE_ONLY && ckWARN(WARN_REGEXP)) -+ vWARN(p, "Invalid escape in the specified encoding"); -+ RExC_utf8 = 1; -+ } - break; - case '\0': - if (p >= RExC_end) -@@ -3330,32 +3376,6 @@ tryagain: - break; - } - -- /* If the encoding pragma is in effect recode the text of -- * any EXACT-kind nodes. */ -- if (PL_encoding && PL_regkind[(U8)OP(ret)] == EXACT) { -- STRLEN oldlen = STR_LEN(ret); -- SV *sv = sv_2mortal(newSVpvn(STRING(ret), oldlen)); -- -- if (RExC_utf8) -- SvUTF8_on(sv); -- if (sv_utf8_downgrade(sv, TRUE)) { -- const char * const s = sv_recode_to_utf8(sv, PL_encoding); -- const STRLEN newlen = SvCUR(sv); -- -- if (SvUTF8(sv)) -- RExC_utf8 = 1; -- if (!SIZE_ONLY) { -- DEBUG_r(PerlIO_printf(Perl_debug_log, "recode %*s to %*s\n", -- (int)oldlen, STRING(ret), -- (int)newlen, s)); -- Copy(s, STRING(ret), newlen, char); -- STR_LEN(ret) += newlen - oldlen; -- RExC_emit += STR_SZ(newlen) - STR_SZ(oldlen); -- } else -- RExC_size += STR_SZ(newlen) - STR_SZ(oldlen); -- } -- } -- - return(ret); - } - -@@ -3733,6 +3753,8 @@ S_regclass(pTHX_ RExC_state_t *pRExC_sta - value = grok_hex(RExC_parse, &numlen, &flags, NULL); - RExC_parse += numlen; - } -+ if (PL_encoding && value < 0x100) -+ goto recode_encoding; - break; - case 'c': - value = UCHARAT(RExC_parse++); -@@ -3740,13 +3762,24 @@ S_regclass(pTHX_ RExC_state_t *pRExC_sta - break; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': -- { -- I32 flags = 0; -- numlen = 3; -- value = grok_oct(--RExC_parse, &numlen, &flags, NULL); -- RExC_parse += numlen; -- break; -- } -+ { -+ I32 flags = 0; -+ numlen = 3; -+ value = grok_oct(--RExC_parse, &numlen, &flags, NULL); -+ RExC_parse += numlen; -+ if (PL_encoding && value < 0x100) -+ goto recode_encoding; -+ break; -+ } -+ recode_encoding: -+ { -+ SV* enc = PL_encoding; -+ value = reg_recode((const char)(U8)value, &enc); -+ if (!enc && SIZE_ONLY && ckWARN(WARN_REGEXP)) -+ vWARN(RExC_parse, -+ "Invalid escape in the specified encoding"); -+ break; -+ } - default: - if (!SIZE_ONLY && isALPHA(value) && ckWARN(WARN_REGEXP)) - vWARN2(RExC_parse, |