summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArseniy Lartsev <arseniy@alumni.chalmers.se>2020-01-07 16:34:39 +0100
committerCorinna Vinschen <corinna@vinschen.de>2020-01-13 16:34:36 +0100
commit4ddf5903fd24feaa6f75ffb12f9cafdd266b386a (patch)
tree461a8260e4d9955a3cb12e43d1e5b2f55f819a80
parent7b6414d459bb66affe077a062b88ca1e1e392fc4 (diff)
downloadcygnal-4ddf5903fd24feaa6f75ffb12f9cafdd266b386a.tar.gz
cygnal-4ddf5903fd24feaa6f75ffb12f9cafdd266b386a.tar.bz2
cygnal-4ddf5903fd24feaa6f75ffb12f9cafdd266b386a.zip
Fixed crash on wine by adding NULL check after memchr
This is not a joke, there are vendors out there who build software for cygwin only. Besides, this NULL check is good to have anyway.
-rw-r--r--winsup/cygwin/path.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index b5efd61b2..c8e73c64c 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -4307,6 +4307,8 @@ find_fast_cwd_pointer ()
const uint8_t *use_cwd = rcall + 5 + offset;
/* Find first `push %edi' instruction. */
const uint8_t *pushedi = (const uint8_t *) memchr (use_cwd, 0x57, 32);
+ if (!pushedi)
+ return NULL;
/* ...which should be followed by `mov crit-sect-addr,%edi' then
`push %edi', or by just a single `push crit-sect-addr'. */
const uint8_t *movedi = pushedi + 1;