src/hb-buffer.cc | 2 ++ src/hb-ot-layout-gsubgpos-private.hh | 2 +- test/fuzzing/Makefile.am | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-)
New commits: commit b87e36f6f119fac80b8fd55f3abae563c2c5b798 Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Feb 19 14:52:31 2016 +0700 Avoid buffer->move_to() in case of buffer error Fixes https://github.com/behdad/harfbuzz/issues/223 Right now we cannot test this because it has to be tested using hb-fuzzer. We should move all fuzzing tests from test/shaping/tests/fuzzed.tests to test/fuzzing/ and have its own test runner. At that point, should add test from this issue as well. diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index c731ed1..5f320bd 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -407,6 +407,8 @@ hb_buffer_t::move_to (unsigned int i) idx = i; return true; } + if (unlikely (in_error)) + return false; assert (i <= out_len + (len - idx)); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index d6db005..3f9d9ca 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -971,7 +971,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, match_positions[j] += delta; } - for (unsigned int i = 0; i < lookupCount; i++) + for (unsigned int i = 0; i < lookupCount && !buffer->in_error; i++) { unsigned int idx = lookupRecord[i].sequenceIndex; if (idx >= count) commit 7e76bbabbaa56af314abff8ddba8866c634919cd Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Feb 19 14:43:39 2016 +0700 [fuzzing] Make "make hb-fuzzer" build lib dependency Not going to do with util/, but is convenient here. diff --git a/test/fuzzing/Makefile.am b/test/fuzzing/Makefile.am index 2b2693f..a726690 100644 --- a/test/fuzzing/Makefile.am +++ b/test/fuzzing/Makefile.am @@ -39,6 +39,9 @@ hb_fuzzer_CPPFLAGS = \ $(AM_CPPFLAGS) \ -DMAIN \ $(NULL) +hb_fuzzer_DEPENDENCIES = \ + lib \ + $(NULL) check: cat $(top_srcdir)/test/shaping/tests/fuzzed.tests | \ _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz