diff options
author | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2019-04-16 14:49:07 +0000 |
---|---|---|
committer | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2019-04-16 14:49:07 +0000 |
commit | 74e493781b2e6675ea98a6814c91aa0debd2b802 (patch) | |
tree | 9178cc72132439783afda5c269f6a614194a7660 /src/pcre2_compile.c | |
parent | a9101e7b07d58fb45459787f34791e93915f76ad (diff) | |
download | pcre2-74e493781b2e6675ea98a6814c91aa0debd2b802.tar.gz |
Casts and rewrites to avoid clang sanitize warnings.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1085 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_compile.c')
-rw-r--r-- | src/pcre2_compile.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index 30db6d5..ab48d2d 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -5948,7 +5948,10 @@ for (;; pptr++) (void)memmove(code + (32 / sizeof(PCRE2_UCHAR)), code, CU2BYTES(class_uchardata - code)); if (negate_class && !xclass_has_prop) - for (i = 0; i < 32; i++) classbits[i] = ~classbits[i]; + { + /* Using 255 ^ instead of ~ avoids clang sanitize warning. */ + for (i = 0; i < 32; i++) classbits[i] = 255 ^ classbits[i]; + } memcpy(code, classbits, 32); code = class_uchardata + (32 / sizeof(PCRE2_UCHAR)); } @@ -5971,7 +5974,10 @@ for (;; pptr++) if (lengthptr == NULL) /* Save time in the pre-compile phase */ { if (negate_class) - for (i = 0; i < 32; i++) classbits[i] = ~classbits[i]; + { + /* Using 255 ^ instead of ~ avoids clang sanitize warning. */ + for (i = 0; i < 32; i++) classbits[i] = 255 ^ classbits[i]; + } memcpy(code, classbits, 32); } code += 32 / sizeof(PCRE2_UCHAR); |