[pcre-dev] [Bug 2429] New: layering violation with pcre2_mak…

Página Principal
Apagar esta mensagem
Autor: admin
Data:  
Para: pcre-dev
Assunto: [pcre-dev] [Bug 2429] New: layering violation with pcre2_maketables make it easier to misuse
https://bugs.exim.org/show_bug.cgi?id=2429

            Bug ID: 2429
           Summary: layering violation with pcre2_maketables make it
                    easier to misuse
           Product: PCRE
           Version: 10.33 (PCRE2)
          Hardware: All
                OS: All
            Status: NEW
          Severity: wishlist
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: carenas@???
                CC: pcre-dev@???


Created attachment 1215
--> https://bugs.exim.org/attachment.cgi?id=1215&action=edit
barebones implementation of proposed API extension and pcre2grep support

pcre2_maketables returns an internally allocated const pointer that is then
suggested should be freed by the user, but that presents two issues :

* the user will be forced to write an awkward cast when calling free to remove
the constness of the object
* there might be a mismatch between the user and library definition of
allocators that will manifest itself only in this case and result in a segfault
(at least observed in windows)

a future API could instead use an opaque type and even change the internal
implementation so these tables could be created at compile time or internally
on demand and therefore be shared more easily, improving performance.

the old API was more reliable by forcing the use of pcre_{malloc,free} which
the library itself controls fully, and so this could be considered a "design
regression".

while changing API would be difficult, the situation could be improved by
extending the current API adding a helper function that could be used to clean
this object and that might be useful as well in the future to make a transition
to an opaque type easier.

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