mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 15:01:01 +01:00
[raster] Guard SVG <use> cycles with hb_decycler_t
This commit is contained in:
1 parent
860beb08b6
commit
f560bbb9e4
3 files changed
+9
-1
No files matched your search
@@ -30,6 +30,7 @@
|
||||
#include "hb.hh"
|
||||
|
||||
#include "OT/Color/svg/svg.hh"
|
||||
#include "hb-decycler.hh"
|
||||
#include "hb-raster-paint.hh"
|
||||
#include "hb-raster-svg-base.hh"
|
||||
#include "hb-raster-svg-defs.hh"
|
||||
@@ -52,6 +53,7 @@ struct hb_svg_use_context_t
|
||||
unsigned doc_len;
|
||||
const OT::SVG::accelerator_t *svg_accel;
|
||||
const OT::SVG::svg_doc_cache_t *doc_cache;
|
||||
hb_decycler_t *use_decycler;
|
||||
};
|
||||
|
||||
struct hb_svg_render_context_t
|
||||
@@ -68,6 +70,7 @@ struct hb_svg_render_context_t
|
||||
unsigned doc_len;
|
||||
const OT::SVG::accelerator_t *svg_accel = nullptr;
|
||||
const OT::SVG::svg_doc_cache_t *doc_cache = nullptr;
|
||||
hb_decycler_t use_decycler;
|
||||
|
||||
void push_transform (float xx, float yx, float xy, float yy, float dx, float dy)
|
||||
{
|
||||
|
||||
@@ -445,7 +445,8 @@ svg_render_element (hb_svg_render_context_t *ctx,
|
||||
{
|
||||
hb_svg_use_context_t use_ctx = {ctx->paint, ctx->pfuncs,
|
||||
ctx->doc_start, ctx->doc_len,
|
||||
ctx->svg_accel, ctx->doc_cache};
|
||||
ctx->svg_accel, ctx->doc_cache,
|
||||
&ctx->use_decycler};
|
||||
hb_raster_svg_render_use_element (&use_ctx, parser, &state, transform_str,
|
||||
svg_render_use_callback, ctx);
|
||||
}
|
||||
|
||||
@@ -171,6 +171,10 @@ hb_raster_svg_render_use_element (const hb_svg_use_context_t *ctx,
|
||||
|
||||
if (found)
|
||||
{
|
||||
hb_decycler_node_t node (*ctx->use_decycler);
|
||||
if (unlikely (!node.visit ((uintptr_t) found)))
|
||||
return;
|
||||
|
||||
unsigned remaining = ctx->doc_start + ctx->doc_len - found;
|
||||
hb_svg_xml_parser_t ref_parser (found, remaining);
|
||||
hb_svg_token_type_t tok = ref_parser.next ();
|
||||
|
||||
Reference in new issue
Block a user