[flags] Fix undefined-behavior
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/hb-buffer.hh:60:1 in failure on clusterfuzz-testcase-minimized-hb-subset-get-codepoints-fuzzer-5736539338833920
This commit is contained in:
parent
f3f9fc1544
commit
45a2252607
|
@ -59,7 +59,7 @@
|
||||||
static inline constexpr T operator | (T l, T r) { return T ((unsigned) l | (unsigned) r); } \
|
static inline constexpr T operator | (T l, T r) { return T ((unsigned) l | (unsigned) r); } \
|
||||||
static inline constexpr T operator & (T l, T r) { return T ((unsigned) l & (unsigned) r); } \
|
static inline constexpr T operator & (T l, T r) { return T ((unsigned) l & (unsigned) r); } \
|
||||||
static inline constexpr T operator ^ (T l, T r) { return T ((unsigned) l ^ (unsigned) r); } \
|
static inline constexpr T operator ^ (T l, T r) { return T ((unsigned) l ^ (unsigned) r); } \
|
||||||
static inline constexpr T operator ~ (T r) { return T (~(unsigned int) r); } \
|
static inline constexpr unsigned operator ~ (T r) { return (~(unsigned) r); } \
|
||||||
static inline T& operator |= (T &l, T r) { l = l | r; return l; } \
|
static inline T& operator |= (T &l, T r) { l = l | r; return l; } \
|
||||||
static inline T& operator &= (T& l, T r) { l = l & r; return l; } \
|
static inline T& operator &= (T& l, T r) { l = l & r; return l; } \
|
||||||
static inline T& operator ^= (T& l, T r) { l = l ^ r; return l; } \
|
static inline T& operator ^= (T& l, T r) { l = l ^ r; return l; } \
|
||||||
|
|
|
@ -102,9 +102,9 @@ buffer_verify_unsafe_to_break (hb_buffer_t *buffer,
|
||||||
/* Check that breaking up shaping at safe-to-break is indeed safe. */
|
/* Check that breaking up shaping at safe-to-break is indeed safe. */
|
||||||
|
|
||||||
hb_buffer_t *fragment = hb_buffer_create_similar (buffer);
|
hb_buffer_t *fragment = hb_buffer_create_similar (buffer);
|
||||||
hb_buffer_set_flags (fragment, hb_buffer_get_flags (fragment) & ~HB_BUFFER_FLAG_VERIFY);
|
hb_buffer_set_flags (fragment, (hb_buffer_flags_t (hb_buffer_get_flags (fragment) & ~HB_BUFFER_FLAG_VERIFY)));
|
||||||
hb_buffer_t *reconstruction = hb_buffer_create_similar (buffer);
|
hb_buffer_t *reconstruction = hb_buffer_create_similar (buffer);
|
||||||
hb_buffer_set_flags (reconstruction, hb_buffer_get_flags (reconstruction) & ~HB_BUFFER_FLAG_VERIFY);
|
hb_buffer_set_flags (reconstruction, (hb_buffer_flags_t (hb_buffer_get_flags (reconstruction) & ~HB_BUFFER_FLAG_VERIFY)));
|
||||||
|
|
||||||
unsigned int num_glyphs;
|
unsigned int num_glyphs;
|
||||||
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, &num_glyphs);
|
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, &num_glyphs);
|
||||||
|
@ -238,10 +238,10 @@ buffer_verify_unsafe_to_concat (hb_buffer_t *buffer,
|
||||||
|
|
||||||
hb_buffer_t *fragments[2] {hb_buffer_create_similar (buffer),
|
hb_buffer_t *fragments[2] {hb_buffer_create_similar (buffer),
|
||||||
hb_buffer_create_similar (buffer)};
|
hb_buffer_create_similar (buffer)};
|
||||||
hb_buffer_set_flags (fragments[0], hb_buffer_get_flags (fragments[0]) & ~HB_BUFFER_FLAG_VERIFY);
|
hb_buffer_set_flags (fragments[0], (hb_buffer_flags_t (hb_buffer_get_flags (fragments[0]) & ~HB_BUFFER_FLAG_VERIFY)));
|
||||||
hb_buffer_set_flags (fragments[1], hb_buffer_get_flags (fragments[1]) & ~HB_BUFFER_FLAG_VERIFY);
|
hb_buffer_set_flags (fragments[1], (hb_buffer_flags_t (hb_buffer_get_flags (fragments[1]) & ~HB_BUFFER_FLAG_VERIFY)));
|
||||||
hb_buffer_t *reconstruction = hb_buffer_create_similar (buffer);
|
hb_buffer_t *reconstruction = hb_buffer_create_similar (buffer);
|
||||||
hb_buffer_set_flags (reconstruction, hb_buffer_get_flags (reconstruction) & ~HB_BUFFER_FLAG_VERIFY);
|
hb_buffer_set_flags (reconstruction, (hb_buffer_flags_t (hb_buffer_get_flags (reconstruction) & ~HB_BUFFER_FLAG_VERIFY)));
|
||||||
hb_segment_properties_t props;
|
hb_segment_properties_t props;
|
||||||
hb_buffer_get_segment_properties (buffer, &props);
|
hb_buffer_get_segment_properties (buffer, &props);
|
||||||
hb_buffer_set_segment_properties (fragments[0], &props);
|
hb_buffer_set_segment_properties (fragments[0], &props);
|
||||||
|
|
Loading…
Reference in New Issue