@@ -1308,6 +1308,9 @@ Perl_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch,
1308
1308
#ifdef DEBUGGING
1309
1309
regnode * optimize = NULL ;
1310
1310
#endif /* DEBUGGING */
1311
+ /* make sure we have enough room to inject the TRIE op */
1312
+ assert ((!trie -> jump ) || !trie -> jump [1 ] ||
1313
+ (trie -> jump [1 ] >= (sizeof (tregnode_TRIE )/sizeof (struct regnode ))));
1311
1314
/*
1312
1315
This means we convert either the first branch or the first Exact,
1313
1316
depending on whether the thing following (in 'last') is a branch
@@ -1478,10 +1481,10 @@ Perl_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch,
1478
1481
*/
1479
1482
if ( !trie -> states [trie -> startstate ].wordnum
1480
1483
&& trie -> bitmap
1481
- && ( (char * )jumper - (char * )convert ) >= (int )sizeof (struct regnode_charclass ) )
1484
+ && ( (char * )jumper - (char * )convert ) >= (int )sizeof (tregnode_TRIEC ) )
1482
1485
{
1483
1486
OP ( convert ) = TRIEC ;
1484
- Copy (trie -> bitmap , ((struct regnode_charclass * )convert )-> bitmap , ANYOF_BITMAP_SIZE , char );
1487
+ Copy (trie -> bitmap , ((tregnode_TRIEC * )convert )-> bitmap , ANYOF_BITMAP_SIZE , char );
1485
1488
PerlMemShared_free (trie -> bitmap );
1486
1489
trie -> bitmap = NULL ;
1487
1490
} else
@@ -1608,14 +1611,14 @@ Perl_construct_ahocorasick_from_trie(pTHX_ RExC_state_t *pRExC_state, regnode *s
1608
1611
#endif
1609
1612
1610
1613
if ( OP (source ) == TRIE ) {
1611
- struct regnode_1 * op = (struct regnode_1 * )
1612
- PerlMemShared_calloc (1 , sizeof (struct regnode_1 ));
1613
- StructCopy (source , op , struct regnode_1 );
1614
+ tregnode_TRIE * op = (tregnode_TRIE * )
1615
+ PerlMemShared_calloc (1 , sizeof (tregnode_TRIE ));
1616
+ StructCopy (source , op , tregnode_TRIE );
1614
1617
stclass = (regnode * )op ;
1615
1618
} else {
1616
- struct regnode_charclass * op = (struct regnode_charclass * )
1617
- PerlMemShared_calloc (1 , sizeof (struct regnode_charclass ));
1618
- StructCopy (source , op , struct regnode_charclass );
1619
+ tregnode_TRIEC * op = (tregnode_TRIEC * )
1620
+ PerlMemShared_calloc (1 , sizeof (tregnode_TRIEC ));
1621
+ StructCopy (source , op , tregnode_TRIEC );
1619
1622
stclass = (regnode * )op ;
1620
1623
}
1621
1624
OP (stclass )+= 2 ; /* convert the TRIE type to its AHO-CORASICK equivalent */
0 commit comments