summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh11
1 files changed, 8 insertions, 3 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh
index 079b94a6b4a..13517a9c29e 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh
@@ -80,7 +80,12 @@ struct hb_vector_t
fini ();
}
- void reset () { resize (0); }
+ void reset ()
+ {
+ if (unlikely (in_error ()))
+ allocated = length; // Big hack!
+ resize (0);
+ }
hb_vector_t& operator = (const hb_vector_t &o)
{
@@ -181,7 +186,7 @@ struct hb_vector_t
/* Allocate for size but don't adjust length. */
bool alloc (unsigned int size)
{
- if (unlikely (allocated < 0))
+ if (unlikely (in_error ()))
return false;
if (likely (size <= (unsigned) allocated))
@@ -195,7 +200,7 @@ struct hb_vector_t
Type *new_array = nullptr;
bool overflows =
- (int) new_allocated < 0 ||
+ (int) in_error () ||
(new_allocated < (unsigned) allocated) ||
hb_unsigned_mul_overflows (new_allocated, sizeof (Type));
if (likely (!overflows))