Skip to content

Commit

Permalink
[native/libc] Don't crash when parsing regexes on FreeBSD (#413)
Browse files Browse the repository at this point in the history
Before:
```
osh$ [[ 1 =~ [0-9] ]]
Segmentation fault (core dumped)
```

After:
```
osh$ [[ 1 =~ [0-9] ]]
osh$ echo $?
0
```

This happened because libc.c used the GNU regex library headers but
used the BSD library when dynamically linked. I'm not sure why it was
using different headers, maybe Python was originally statically linked?
  • Loading branch information
jyn514 authored and andychu committed Jul 7, 2019
1 parent 4e6d32f commit 66476b1
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions native/libc.c
Expand Up @@ -16,11 +16,7 @@

#include <fnmatch.h>
#include <glob.h>
#ifdef __FreeBSD__
#include <gnu/posix/regex.h>
#else
#include <regex.h>
#endif

#include <Python.h>

Expand Down

0 comments on commit 66476b1

Please sign in to comment.