@@ -1014,7 +1014,7 @@ hexadecimal range format should use only capital characters"));
prefix_len = (cp - from) + 1;
- if (cp == &from[len1 - 1] || strncmp (from, to, prefix_len) != 0)
+ if (check_illegal_range (cp, from, len1, to, prefix_len))
goto illegal_range;
errno = 0;
@@ -62,6 +62,13 @@ struct charseq
unsigned char bytes[];
};
+static inline bool
+__attribute_disable_ubsan__
+check_illegal_range (const char *cp, const char *from, size_t len1,
+ const char *to, size_t prefix_len)
+{
+ return cp == &from[len1 - 1] || strncmp (from, to, prefix_len) != 0;
+}
/* True if the encoding is not ASCII compatible. */
extern bool enc_not_ascii_compatible;
@@ -433,7 +433,7 @@ hexadecimal range format should use only capital characters"));
prefix_len = (cp - from) + 1;
- if (cp == &from[len1 - 1] || strncmp (from, to, prefix_len) != 0)
+ if (check_illegal_range (cp, from, len1, to, prefix_len))
goto invalid_range;
errno = 0;