From bef5a1c8dc5fd2930e2fd395ad6c1ec4a6a0c2c3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 18 Nov 2022 17:22:17 -0700 Subject: [PATCH] [vector] Comment --- src/hb-vector.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index fb6362ab3..58286892b 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -95,7 +95,11 @@ struct hb_vector_t void reset () { if (unlikely (in_error ())) - allocated = length; // Big hack! + /* Big Hack! We don't know the true allocated size before + * an allocation failure happened. But we know it was at + * least as big as length. Restore it to that and continue + * as if error did not happen. */ + allocated = length; resize (0); }