[pcre-dev] [Bug 2575] New: RE unsafe in static initializers

Top Page

Reply to this message
Author: admin
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 2575] New: RE unsafe in static initializers
https://bugs.exim.org/show_bug.cgi?id=2575

            Bug ID: 2575
           Summary: RE unsafe in static initializers
           Product: PCRE
           Version: 8.44
          Hardware: All
                OS: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: billy.donahue@???
                CC: pcre-dev@???


ASAN reports an initialization order fiasco when I create an RE to initialize a
static-duration variable, because the static `default_options` variable hasn't
been initialized yet.

In RE::Init, line 106 of pcrecpp.cc, here
https://vcs.pcre.org/pcre/code/trunk/pcrecpp.cc?annotate=1763&pathrev=1763

    options_ = default_options;


But default_options was defined on line 82 as a nonlocal static.

static RE_Options default_options;


There are lots of fixes.
One fix might be to bring default_options inside the Init function.

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