Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Maintenance:5475
harfbuzz.openSUSE_13.2_Update
harfbuzz-oom-handling.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File harfbuzz-oom-handling.patch of Package harfbuzz.openSUSE_13.2_Update
From abadc1717d997b69f987fdf1be9e12156d2d13d6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod <behdad@behdad.org> Date: Wed, 18 Nov 2015 17:52:08 -0800 Subject: [PATCH] Try to better handle OOM situations Fixes assert fail in https://github.com/behdad/harfbuzz/issues/161 with libharfbuzz-fuzzing. Rebased by Mike Gorse <mgorse@suse.com> --- diff -urp harfbuzz-0.9.27.orig/src/hb-ot-layout.cc harfbuzz-0.9.27/src/hb-ot-layout.cc --- harfbuzz-0.9.27.orig/src/hb-ot-layout.cc 2013-11-20 13:18:31.718614915 -0600 +++ harfbuzz-0.9.27/src/hb-ot-layout.cc 2016-07-28 12:39:08.035117262 -0500 @@ -839,7 +839,7 @@ apply_string (OT::hb_apply_context_t *c, buffer->clear_output (); buffer->idx = 0; - while (buffer->idx < buffer->len) + while (buffer->idx < buffer->len && !buffer->in_error) { if (accel.digest.may_have (buffer->cur().codepoint) && (buffer->cur().mask & c->lookup_mask) && @@ -878,6 +878,29 @@ apply_string (OT::hb_apply_context_t *c, return ret; } +struct hb_apply_forward_context_t +{ + inline const char *get_name (void) { return "APPLY_FORWARD"; } + static const unsigned int max_debug_depth = HB_DEBUG_APPLY; + typedef bool return_t; + template <typename T, typename F> + inline bool may_dispatch (const T *obj, const F *format) { return true; } + template <typename T> + inline return_t dispatch (const T &obj) { return apply_forward (c, obj, accel); } + static return_t default_return_value (void) { return false; } + bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return true; } + + hb_apply_forward_context_t (OT::hb_apply_context_t *c_, + const hb_ot_layout_lookup_accelerator_t &accel_) : + c (c_), + accel (accel_), + debug_depth (0) {} + + OT::hb_apply_context_t *c; + const hb_ot_layout_lookup_accelerator_t &accel; + unsigned int debug_depth; +}; + template <typename Proxy> inline void hb_ot_map_t::apply (const Proxy &proxy, const hb_ot_shape_plan_t *plan, diff -urp harfbuzz-0.9.27.orig/src/hb-ot-layout-gsubgpos-private.hh harfbuzz-0.9.27/src/hb-ot-layout-gsubgpos-private.hh --- harfbuzz-0.9.27.orig/src/hb-ot-layout-gsubgpos-private.hh 2013-12-09 22:54:36.723199278 -0600 +++ harfbuzz-0.9.27/src/hb-ot-layout-gsubgpos-private.hh 2016-07-28 12:39:08.035117262 -0500 @@ -857,7 +857,7 @@ static inline void ligate_input (hb_appl for (unsigned int i = 1; i < count; i++) { - while (buffer->idx < match_positions[i]) + while (buffer->idx < match_positions[i] && !buffer->in_error) { if (!is_mark_ligature) { unsigned int new_lig_comp = components_so_far - last_num_components + diff -urp harfbuzz-0.9.27.orig/src/hb-ot-shape.cc harfbuzz-0.9.27/src/hb-ot-shape.cc --- harfbuzz-0.9.27.orig/src/hb-ot-shape.cc 2014-02-21 00:58:53.575799088 -0600 +++ harfbuzz-0.9.27/src/hb-ot-shape.cc 2016-07-28 12:39:08.035117262 -0500 @@ -252,7 +252,7 @@ hb_insert_dotted_circle (hb_buffer_t *bu info.cluster = buffer->cur().cluster; info.mask = buffer->cur().mask; buffer->output_info (info); - while (buffer->idx < buffer->len) + while (buffer->idx < buffer->len && !buffer->in_error) buffer->next_glyph (); buffer->swap_buffers (); diff -urp harfbuzz-0.9.27.orig/src/hb-ot-shape-complex-hangul.cc harfbuzz-0.9.27/src/hb-ot-shape-complex-hangul.cc --- harfbuzz-0.9.27.orig/src/hb-ot-shape-complex-hangul.cc 2014-01-22 06:46:42.649236746 -0600 +++ harfbuzz-0.9.27/src/hb-ot-shape-complex-hangul.cc 2016-07-28 12:39:08.035117262 -0500 @@ -179,7 +179,7 @@ preprocess_text_hangul (const hb_ot_shap */ unsigned int count = buffer->len; - for (buffer->idx = 0; buffer->idx < count;) + for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;) { hb_codepoint_t u = buffer->cur().codepoint; diff -urp harfbuzz-0.9.27.orig/src/hb-ot-shape-complex-indic.cc harfbuzz-0.9.27/src/hb-ot-shape-complex-indic.cc --- harfbuzz-0.9.27.orig/src/hb-ot-shape-complex-indic.cc 2013-12-31 02:23:48.852745414 -0600 +++ harfbuzz-0.9.27/src/hb-ot-shape-complex-indic.cc 2016-07-28 12:39:08.039117262 -0500 @@ -1244,7 +1244,7 @@ insert_dotted_circles (const hb_ot_shape buffer->idx = 0; unsigned int last_syllable = 0; - while (buffer->idx < buffer->len) + while (buffer->idx < buffer->len && !buffer->in_error) { unsigned int syllable = buffer->cur().syllable(); syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); diff -urp harfbuzz-0.9.27.orig/src/hb-ot-shape-complex-thai.cc harfbuzz-0.9.27/src/hb-ot-shape-complex-thai.cc --- harfbuzz-0.9.27.orig/src/hb-ot-shape-complex-thai.cc 2013-12-31 02:38:34.903413108 -0600 +++ harfbuzz-0.9.27/src/hb-ot-shape-complex-thai.cc 2016-07-28 12:39:08.039117262 -0500 @@ -315,7 +315,7 @@ preprocess_text_thai (const hb_ot_shape_ buffer->clear_output (); unsigned int count = buffer->len; - for (buffer->idx = 0; buffer->idx < count;) + for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;) { hb_codepoint_t u = buffer->cur().codepoint; if (likely (!IS_SARA_AM (u))) { diff -urp harfbuzz-0.9.27.orig/src/hb-ot-shape-normalize.cc harfbuzz-0.9.27/src/hb-ot-shape-normalize.cc --- harfbuzz-0.9.27.orig/src/hb-ot-shape-normalize.cc 2014-01-22 06:53:49.897700759 -0600 +++ harfbuzz-0.9.27/src/hb-ot-shape-normalize.cc 2016-07-28 12:39:08.039117262 -0500 @@ -218,7 +218,7 @@ handle_variation_selector_cluster (const /* TODO Currently if there's a variation-selector we give-up, it's just too hard. */ hb_buffer_t * const buffer = c->buffer; hb_font_t * const font = c->font; - for (; buffer->idx < end - 1;) { + for (; buffer->idx < end - 1 && !buffer->in_error;) { if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) { /* The next two lines are some ugly lines... But work. */ if (font->get_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index())) @@ -254,13 +254,13 @@ static inline void decompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit) { hb_buffer_t * const buffer = c->buffer; - for (unsigned int i = buffer->idx; i < end; i++) + for (unsigned int i = buffer->idx; i < end && !buffer->in_error; i++) if (unlikely (buffer->unicode->is_variation_selector (buffer->info[i].codepoint))) { handle_variation_selector_cluster (c, end, short_circuit); return; } - while (buffer->idx < end) + while (buffer->idx < end && !buffer->in_error) decompose_current_character (c, short_circuit); } @@ -316,7 +316,7 @@ _hb_ot_shape_normalize (const hb_ot_shap buffer->clear_output (); count = buffer->len; - for (buffer->idx = 0; buffer->idx < count;) + for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;) { unsigned int end; for (end = buffer->idx + 1; end < count; end++) @@ -368,7 +368,7 @@ _hb_ot_shape_normalize (const hb_ot_shap count = buffer->len; unsigned int starter = 0; buffer->next_glyph (); - while (buffer->idx < count) + while (buffer->idx < count && !buffer->in_error) { hb_codepoint_t composed, glyph; if (/* We don't try to compose a non-mark character with it's preceding starter.
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor