From f90039530aefc66446e68f0a752b598967d100ac Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sat, 14 Oct 2006 23:06:52 +0000 Subject: [PATCH] Avoid undefined behaviour for -DPERL_MEM_LOG by not using a dereference of member of the structure being reallocated as part of the size calculation. (This one was well hidden by macros) p4raw-id: //depot/perl@29018 --- regcomp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/regcomp.c b/regcomp.c index 7661432..86e6865 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1133,9 +1133,8 @@ is the recommended Unicode-aware way of saying #define TRIE_LIST_PUSH(state,fid,ns) STMT_START { \ if ( TRIE_LIST_CUR( state ) >=TRIE_LIST_LEN( state ) ) { \ - TRIE_LIST_LEN( state ) *= 2; \ - Renew( trie->states[ state ].trans.list, \ - TRIE_LIST_LEN( state ), reg_trie_trans_le ); \ + U32 ging = TRIE_LIST_LEN( state ) *= 2; \ + Renew( trie->states[ state ].trans.list, ging, reg_trie_trans_le ); \ } \ TRIE_LIST_ITEM( state, TRIE_LIST_CUR( state ) ).forid = fid; \ TRIE_LIST_ITEM( state, TRIE_LIST_CUR( state ) ).newstate = ns; \ -- 2.7.4