<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">
<div>For some reason gpg doesn’t seem to like when a RegEx is compiled in the constructor of a preloaded library. I haven’t seen this happen in other software, any ideas what could be causing this?</div>
<div> </div>
<div>Minimum repo:</div>
<div> </div>
<div>File `/tmp/repo.c`:</div>
<div> </div>
<div>```c<br />
#define _GNU_SOURCE<br />
#include <regex.h></div>
<div> </div>
<div>__attribute__((constructor)) static void init(void) {<br />
 regex_t regex;<br />
 regcomp(&regex, "", 0);<br />
}<br />
```</div>
<div> </div>
<div>Shell:</div>
<div> </div>
<div>```sh<br />
gcc -shared -fPIC -o /tmp/<a href="repro.so">repro.so</a> /tmp/repro.c<br />
export LD_PRELOAD=/tmp/<a href="repro.so">repro.so</a><br />
gpg --list-keys<br />
```</div>
<div> </div>
<div>Output:</div>
<div> </div>
<div>```<br />
*** stack smashing detected ***: terminated<br />
Aborted<br />
```</div>
</div>
</body>
</html>