]> git.vpit.fr Git - perl/modules/re-engine-Plugin.git/blobdiff - Plugin.xs
Fix an off-by-one error when allocating the parens buffer
[perl/modules/re-engine-Plugin.git] / Plugin.xs
index 5e5452a5438d48d56b42fc7f60195d7756198287..2ebc28deebb9c3be4afe92773fcc1aaaec4efc23 100644 (file)
--- a/Plugin.xs
+++ b/Plugin.xs
@@ -44,13 +44,11 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags)
     dSP;
     REGEXP * rx;
     re__engine__Plugin re;
-    I32 count;
     I32 buffers;
 
     /* exp/xend version of the pattern & length */
     STRLEN plen;
     char*  exp = SvPV((SV*)pattern, plen);
-    char* xend = exp + plen;
 
     /* The REGEXP structure to return to perl */
     Newxz(rx, 1, REGEXP);
@@ -112,7 +110,7 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags)
 
     buffers = rx->nparens;
 
-    Newxz(rx->offs, buffers, regexp_paren_pair);
+    Newxz(rx->offs, buffers + 1, regexp_paren_pair);
 
     return rx;
 }
@@ -210,9 +208,9 @@ Plugin_free(pTHX_ REGEXP * const rx)
 }
 
 void *
-Plugin_dupe(pTHX_ const REGEXP * rx, CLONE_PARAMS *param)
+Plugin_dupe(pTHX_ REGEXP * const rx, CLONE_PARAMS *param)
 {
-    Perl_croak("dupe not supported yet");
+    Perl_croak(aTHX_ "dupe not supported yet");
     return rx->pprivate;
 }
 
@@ -261,7 +259,6 @@ Plugin_numbered_buff_STORE(pTHX_ REGEXP * const rx, const I32 paren,
                            SV const * const value)
 {
     dSP;
-    I32 items;
     SV * callback;
     GET_SELF_FROM_PPRIVATE(rx->pprivate);
 
@@ -290,7 +287,6 @@ Plugin_numbered_buff_LENGTH(pTHX_ REGEXP * const rx, const SV * const sv,
                               const I32 paren)
 {
     dSP;
-    I32 items;
     SV * callback;
     GET_SELF_FROM_PPRIVATE(rx->pprivate);