Casts and rewrites to avoid clang sanitize warnings.

This commit is contained in:
Philip.Hazel 2019-04-16 14:49:07 +00:00
parent e17e54711b
commit 4acee004ec
3 changed files with 12 additions and 5 deletions

View File

@ -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);

View File

@ -673,7 +673,8 @@ for(;;)
map = (uint8_t *)ccode;
if (invertmap)
{
for (i = 0; i < 32; i++) inverted_map[i] = ~map[i];
/* Using 255 ^ instead of ~ avoids clang sanitize warning. */
for (i = 0; i < 32; i++) inverted_map[i] = 255 ^ map[i];
map = inverted_map;
}

View File

@ -6861,7 +6861,7 @@ while ((c = *p++) != 0)
fprintf(outfile, "** Truncation will probably give the wrong "
"result.\n");
}
*q8++ = c;
*q8++ = (uint8_t)c;
}
}
#endif
@ -6895,7 +6895,7 @@ while ((c = *p++) != 0)
"result.\n");
}
*q16++ = c;
*q16++ = (uint16_t)c;
}
}
#endif