summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2016-05-19 18:02:51 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2016-05-19 18:02:51 +0000
commit1985a2d4dd5c40128d8ab3517b2003535b0c8acb (patch)
tree0950d7143fb5fdc8ec8e48c102c954cedfb68a1b
parent73a3b8d612963d2892cf381c8f18a0e8dd71a279 (diff)
downloadpcre-1985a2d4dd5c40128d8ab3517b2003535b0c8acb.tar.gz
A racing condition is fixed in JIT reported by Mozilla.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1647 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog2
-rw-r--r--sljit/sljitUtils.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 41bbd5c..24e35e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -79,6 +79,8 @@ Version 8.39 xx-xxxxxx-201x
that certain errors, provoked by the SSE2 instruction set when JIT is used,
are ignored.
+20. A racing condition is fixed in JIT reported by Mozilla.
+
Version 8.38 23-November-2015
-----------------------------
diff --git a/sljit/sljitUtils.c b/sljit/sljitUtils.c
index 6bd17e5..ec5c321 100644
--- a/sljit/sljitUtils.c
+++ b/sljit/sljitUtils.c
@@ -182,7 +182,10 @@ static pthread_mutex_t dev_zero_mutex = PTHREAD_MUTEX_INITIALIZER;
static SLJIT_INLINE sljit_s32 open_dev_zero(void)
{
pthread_mutex_lock(&dev_zero_mutex);
- dev_zero = open("/dev/zero", O_RDWR);
+ /* The dev_zero might be initialized by another thread during the waiting. */
+ if (dev_zero < 0) {
+ dev_zero = open("/dev/zero", O_RDWR);
+ }
pthread_mutex_unlock(&dev_zero_mutex);
return dev_zero < 0;
}