[pcre-dev] [Bug 1758] New: pcre_stack_malloc/free are not ca…

Startseite
Nachricht löschen
Autor: admin
Datum:  
To: pcre-dev
Betreff: [pcre-dev] [Bug 1758] New: pcre_stack_malloc/free are not called in a stack-like manner
https://bugs.exim.org/show_bug.cgi?id=1758

            Bug ID: 1758
           Summary: pcre_stack_malloc/free are not called in a stack-like
                    manner
           Product: PCRE
           Version: 8.37
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: jay.foad@???
                CC: pcre-dev@???


man pcreapi says:

> The global variables pcre_stack_malloc and pcre_stack_free are also
> indirections to memory management functions. These special functions are used
> only when PCRE is compiled to use the heap for remembering data, instead of
> recursive function calls, when running the pcre_exec() function. [...] When
> used, these functions are always called in a stack-like manner (last obtained,
> first freed)


In practice this is not true. pcre_stack_free is called from
release_match_heapframes (in pcre_exec.c) which runs through a linked list of
allocated frames, freeing them *least* recently allocated first.

This broke my app when upgrading from PCRE 8.12 to 8.37, because I have custom
pcre_stack_malloc/free functions that keep track of how many frames have been
allocated, and use a different strategy for allocating/freeing the first 100 vs
all the other ones.

--
You are receiving this mail because:
You are on the CC list for the bug.