public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Benjamin A. Beasley <code@musicinmybrain.net>
To: git-commits@fedoraproject.org
Subject: [rpms/python-ezdxf] f45: Backport unreleased patch for CVE-2026-137506; close RHBZ#2588045
Date: Wed, 02 Dec 2026 12:03:32 GMT [thread overview]
Message-ID: <179621301224.1.11147157050696279690.rpms-python-ezdxf-388bc45ee9fe@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/python-ezdxf
Branch : f45
Commit : 388bc45ee9fe52a0d12e2c3dd2b76d3cd1a1aaad
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date : 2026-12-02T11:56:59+00:00
Stats : +330/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-ezdxf/c/388bc45ee9fe52a0d12e2c3dd2b76d3cd1a1aaad?branch=f45
Log:
Backport unreleased patch for CVE-2026-137506; close RHBZ#2588045
---
diff --git a/8cde125a7370afb5988f73b978599172c05f53fd.patch b/8cde125a7370afb5988f73b978599172c05f53fd.patch
new file mode 100644
index 0000000..5d3b43d
--- /dev/null
+++ b/8cde125a7370afb5988f73b978599172c05f53fd.patch
@@ -0,0 +1,320 @@
+From 8cde125a7370afb5988f73b978599172c05f53fd Mon Sep 17 00:00:00 2001
+From: mozman <me@mozman.at>
+Date: Thu, 26 Nov 2026 07:16:25 +0100
+Subject: [PATCH] fix: dxf2code, table names can contain single quotes
+
+---
+ src/ezdxf/addons/dxf2code.py | 131 +++++-------------
+ .../test_803_entities_to_code.py | 9 ++
+ 2 files changed, 46 insertions(+), 94 deletions(-)
+
+diff --git a/src/ezdxf/addons/dxf2code.py b/src/ezdxf/addons/dxf2code.py
+index 0188254c2..19bc9a0de 100644
+--- a/src/ezdxf/addons/dxf2code.py
++++ b/src/ezdxf/addons/dxf2code.py
+@@ -120,9 +120,7 @@ def block_to_code(
+ return code.code
+
+
+-def table_entries_to_code(
+- entities: Iterable[DXFEntity], drawing="doc"
+-) -> Code:
++def table_entries_to_code(entities: Iterable[DXFEntity], drawing="doc") -> Code:
+ code = _SourceCodeGenerator(doc=drawing)
+ code.translate_entities(entities)
+ return code.code
+@@ -261,9 +259,7 @@ def cleanup(values: Iterable) -> Iterable:
+ yield fmt.format(str(v))
+
+
+-def _fmt_api_call(
+- func_call: str, args: Iterable[str], dxfattribs: dict
+-) -> list[str]:
++def _fmt_api_call(func_call: str, args: Iterable[str], dxfattribs: dict) -> list[str]:
+ attributes = dict(dxfattribs)
+ args = list(args) if args else []
+
+@@ -474,12 +470,13 @@ def new_table_entry(self, dxftype: str, dxfattribs: dict) -> Iterable[str]:
+ """
+ table = f"{self.doc}.{TABLENAMES[dxftype]}"
+ dxfattribs = _purge_handles(dxfattribs)
++ # single quotes ' are allowed in table names
+ name = dxfattribs.pop("name")
+ s = [
+- f"if '{name}' not in {table}:",
+- f" t = {table}.new(",
+- f" '{name}',",
+- " dxfattribs={",
++ f'if "{name}" not in {table}:',
++ f' t = {table}.new(',
++ f' "{name}",',
++ ' dxfattribs={',
+ ]
+ s.extend(_fmt_mapping(dxfattribs, indent=12))
+ s.extend(
+@@ -504,9 +501,7 @@ def _point(self, entity: DXFEntity) -> None:
+
+ def _circle(self, entity: DXFEntity) -> None:
+ self.add_source_code_lines(
+- self.api_call(
+- "add_circle(", ["center", "radius"], entity.dxfattribs()
+- )
++ self.api_call("add_circle(", ["center", "radius"], entity.dxfattribs())
+ )
+
+ def _arc(self, entity: DXFEntity) -> None:
+@@ -524,38 +519,26 @@ def _text(self, entity: DXFEntity) -> None:
+ )
+
+ def _solid(self, entity: DXFEntity) -> None:
+- self.add_source_code_lines(
+- self.generic_api_call("SOLID", entity.dxfattribs())
+- )
++ self.add_source_code_lines(self.generic_api_call("SOLID", entity.dxfattribs()))
+
+ def _trace(self, entity: DXFEntity) -> None:
+- self.add_source_code_lines(
+- self.generic_api_call("TRACE", entity.dxfattribs())
+- )
++ self.add_source_code_lines(self.generic_api_call("TRACE", entity.dxfattribs()))
+
+ def _3dface(self, entity: DXFEntity) -> None:
+- self.add_source_code_lines(
+- self.generic_api_call("3DFACE", entity.dxfattribs())
+- )
++ self.add_source_code_lines(self.generic_api_call("3DFACE", entity.dxfattribs()))
+
+ def _shape(self, entity: DXFEntity) -> None:
+ self.add_source_code_lines(
+- self.api_call(
+- "add_shape(", ["name", "insert", "size"], entity.dxfattribs()
+- )
++ self.api_call("add_shape(", ["name", "insert", "size"], entity.dxfattribs())
+ )
+
+ def _attrib(self, entity: DXFEntity) -> None:
+ self.add_source_code_lines(
+- self.api_call(
+- "add_attrib(", ["tag", "text", "insert"], entity.dxfattribs()
+- )
++ self.api_call("add_attrib(", ["tag", "text", "insert"], entity.dxfattribs())
+ )
+
+ def _attdef(self, entity: DXFEntity) -> None:
+- self.add_source_code_lines(
+- self.generic_api_call("ATTDEF", entity.dxfattribs())
+- )
++ self.add_source_code_lines(self.generic_api_call("ATTDEF", entity.dxfattribs()))
+
+ def _ellipse(self, entity: DXFEntity) -> None:
+ self.add_source_code_lines(
+@@ -580,27 +563,21 @@ def _viewport(self, entity: DXFEntity) -> None:
+ def _insert(self, entity: Insert) -> None:
+ self.code.blocks.add(entity.dxf.name)
+ self.add_source_code_lines(
+- self.api_call(
+- "add_blockref(", ["name", "insert"], entity.dxfattribs()
+- )
++ self.api_call("add_blockref(", ["name", "insert"], entity.dxfattribs())
+ )
+ if len(entity.attribs):
+ for attrib in entity.attribs:
+ dxfattribs = attrib.dxfattribs()
+- dxfattribs[
+- "layer"
+- ] = entity.dxf.layer # set ATTRIB layer to same as INSERT
++ dxfattribs["layer"] = (
++ entity.dxf.layer
++ ) # set ATTRIB layer to same as INSERT
+ self.add_source_code_lines(
+- self.generic_api_call(
+- "ATTRIB", attrib.dxfattribs(), prefix="a = "
+- )
++ self.generic_api_call("ATTRIB", attrib.dxfattribs(), prefix="a = ")
+ )
+ self.add_source_code_line("e.attribs.append(a)")
+
+ def _mtext(self, entity: MText) -> None:
+- self.add_source_code_lines(
+- self.generic_api_call("MTEXT", entity.dxfattribs())
+- )
++ self.add_source_code_lines(self.generic_api_call("MTEXT", entity.dxfattribs()))
+ # MTEXT content 'text' is not a single DXF tag and therefore not a DXF
+ # attribute
+ self.add_source_code_line("e.text = {}".format(json.dumps(entity.text)))
+@@ -630,9 +607,7 @@ def _spline(self, entity: Spline) -> None:
+ )
+
+ if len(entity.knots):
+- self.add_list_source_code(
+- entity.knots, prolog="e.knots = [", epilog="]"
+- )
++ self.add_list_source_code(entity.knots, prolog="e.knots = [", epilog="]")
+
+ if len(entity.weights):
+ self.add_list_source_code(
+@@ -648,9 +623,7 @@ def _polyline(self, entity: Polyline) -> None:
+ attribs = _purge_handles(v.dxfattribs())
+ location = attribs.pop("location")
+ if "layer" in attribs:
+- del attribs[
+- "layer"
+- ] # layer is automatically set to the POLYLINE layer
++ del attribs["layer"] # layer is automatically set to the POLYLINE layer
+
+ # each VERTEX can have different DXF attributes: bulge, start_width, end_width ...
+ self.add_source_code_line(
+@@ -661,17 +634,13 @@ def _leader(self, entity: Leader):
+ self.add_source_code_line(
+ "# Dimension style attribute overriding is not supported!"
+ )
+- self.add_source_code_lines(
+- self.generic_api_call("LEADER", entity.dxfattribs())
+- )
++ self.add_source_code_lines(self.generic_api_call("LEADER", entity.dxfattribs()))
+ self.add_list_source_code(
+ entity.vertices, prolog="e.set_vertices([", epilog="])"
+ )
+
+ def _dimension(self, entity: Dimension):
+- self.add_import_statement(
+- "from ezdxf.dimstyleoverride import DimStyleOverride"
+- )
++ self.add_import_statement("from ezdxf.dimstyleoverride import DimStyleOverride")
+ self.add_source_code_line(
+ "# Dimension style attribute overriding is not supported!"
+ )
+@@ -693,9 +662,7 @@ def _image(self, entity: Image):
+ "# Image requires IMAGEDEF and IMAGEDEFREACTOR objects in the "
+ "OBJECTS section!"
+ )
+- self.add_source_code_lines(
+- self.generic_api_call("IMAGE", entity.dxfattribs())
+- )
++ self.add_source_code_lines(self.generic_api_call("IMAGE", entity.dxfattribs()))
+ if len(entity.boundary_path):
+ self.add_list_source_code(
+ (v for v in entity.boundary_path), # just x, y axis
+@@ -719,9 +686,7 @@ def _wipeout(self, entity: Wipeout):
+ )
+
+ def _mesh(self, entity: Mesh):
+- self.add_source_code_lines(
+- self.api_call("add_mesh(", [], entity.dxfattribs())
+- )
++ self.add_source_code_lines(self.api_call("add_mesh(", [], entity.dxfattribs()))
+ if len(entity.vertices):
+ self.add_list_source_code(
+ entity.vertices, prolog="e.vertices = [", epilog="]"
+@@ -748,9 +713,7 @@ def _mesh(self, entity: Mesh):
+ def _hatch(self, entity: Hatch):
+ dxfattribs = entity.dxfattribs()
+ dxfattribs["associative"] = 0 # associative hatch not supported
+- self.add_source_code_lines(
+- self.api_call("add_hatch(", ["color"], dxfattribs)
+- )
++ self.add_source_code_lines(self.api_call("add_hatch(", ["color"], dxfattribs))
+ self._polygon(entity)
+
+ def _mpolygon(self, entity: MPolygon):
+@@ -799,12 +762,8 @@ def _polygon(self, entity: DXFPolygon):
+ add_line(arg.format("flags", str(path.path_type_flags)))
+ add_line(")")
+ else: # EdgePath
+- add_line(
+- f"# {count}. edge path: associative hatch not supported"
+- )
+- add_line(
+- f"ep = e.paths.add_edge_path(flags={path.path_type_flags})"
+- )
++ add_line(f"# {count}. edge path: associative hatch not supported")
++ add_line(f"ep = e.paths.add_edge_path(flags={path.path_type_flags})")
+ for edge in path.edges:
+ if edge.type == EdgeType.LINE:
+ add_line(f"ep.add_line({edge.start}, {str(edge.end)})")
+@@ -846,40 +805,28 @@ def _polygon(self, entity: DXFPolygon):
+ )
+ )
+ if edge.knot_values:
+- add_line(
+- arg.format("knot_values", str(edge.knot_values))
+- )
++ add_line(arg.format("knot_values", str(edge.knot_values)))
+ if edge.weights:
+ add_line(arg.format("weights", str(edge.weights)))
+ add_line(arg.format("degree", edge.degree))
+ add_line(arg.format("periodic", edge.periodic))
+ if edge.start_tangent is not None:
+ add_line(
+- arg.format(
+- "start_tangent", str(edge.start_tangent)
+- )
++ arg.format("start_tangent", str(edge.start_tangent))
+ )
+ if edge.end_tangent is not None:
+- add_line(
+- arg.format("end_tangent", str(edge.end_tangent))
+- )
++ add_line(arg.format("end_tangent", str(edge.end_tangent)))
+ add_line(")")
+
+ # simple table entries
+ def _layer(self, layer: DXFEntity):
+- self.add_source_code_lines(
+- self.new_table_entry("LAYER", layer.dxfattribs())
+- )
++ self.add_source_code_lines(self.new_table_entry("LAYER", layer.dxfattribs()))
+
+ def _ltype(self, ltype: Linetype):
+ self.add_import_statement("from ezdxf.lldxf.tags import Tags")
+ self.add_import_statement("from ezdxf.lldxf.types import dxftag")
+- self.add_import_statement(
+- "from ezdxf.entities.ltype import LinetypePattern"
+- )
+- self.add_source_code_lines(
+- self.new_table_entry("LTYPE", ltype.dxfattribs())
+- )
++ self.add_import_statement("from ezdxf.entities.ltype import LinetypePattern")
++ self.add_source_code_lines(self.new_table_entry("LTYPE", ltype.dxfattribs()))
+ self.add_tags_source_code(
+ ltype.pattern_tags.tags,
+ prolog="tags = Tags([",
+@@ -889,9 +836,7 @@ def _ltype(self, ltype: Linetype):
+ self.add_source_code_line(" t.pattern_tags = LinetypePattern(tags)")
+
+ def _style(self, style: DXFEntity):
+- self.add_source_code_lines(
+- self.new_table_entry("STYLE", style.dxfattribs())
+- )
++ self.add_source_code_lines(self.new_table_entry("STYLE", style.dxfattribs()))
+
+ def _dimstyle(self, dimstyle: DXFEntity):
+ self.add_source_code_lines(
+@@ -899,6 +844,4 @@ def _dimstyle(self, dimstyle: DXFEntity):
+ )
+
+ def _appid(self, appid: DXFEntity):
+- self.add_source_code_lines(
+- self.new_table_entry("APPID", appid.dxfattribs())
+- )
++ self.add_source_code_lines(self.new_table_entry("APPID", appid.dxfattribs()))
+diff --git a/tests/test_08_addons/test_803_entities_to_code.py b/tests/test_08_addons/test_803_entities_to_code.py
+index 7401150fe..0c70f47cd 100644
+--- a/tests/test_08_addons/test_803_entities_to_code.py
++++ b/tests/test_08_addons/test_803_entities_to_code.py
+@@ -422,6 +422,15 @@ def test_layer_entry():
+ assert layer.dxf.color == 3
+
+
++def test_layer_name_contains_single_quote():
++ from ezdxf.entities.layer import Layer
++
++ layer = Layer.new("LAYER", dxfattribs={"name": "Test'Test", "color": 3})
++ code = table_entries_to_code([layer], drawing="doc")
++ exec(str(code), globals())
++ layer = doc.layers.get("Test'Test")
++ assert layer.dxf.color == 3
++
+ def test_ltype_entry():
+ from ezdxf.entities.ltype import Linetype
+
diff --git a/python-ezdxf.spec b/python-ezdxf.spec
index 04842d8..7c57369 100644
--- a/python-ezdxf.spec
+++ b/python-ezdxf.spec
@@ -68,6 +68,16 @@ Source17: ezdxf-info.1
Source18: ezdxf-strip.1
Source19: ezdxf-view.1
+# fix: dxf2code, table names can contain single quotes
+# https://github.com/mozman/ezdxf/commit/8cde125a7370afb5988f73b978599172c05f53fd
+#
+# Fixes CVE-2026-137506, RHBZ#2588045:
+#
+# https://github.com/mozman/ezdxf/issues/1489, ezdxf: code injection in
+# dxf2code output via unescaped DXF table entry names (CWE-94)
+# https://www.cve.org/CVERecord?id=CVE-2026-137506
+Patch: %{forgeurl}/commit/8cde125a7370afb5988f73b978599172c05f53fd.patch
+
BuildSystem: pyproject
BuildOption(generate_buildrequires): --extras draw,dev,draw5,dev5
BuildOption(install): --assert-license ezdxf
reply other threads:[~2026-12-02 12:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179621301224.1.11147157050696279690.rpms-python-ezdxf-388bc45ee9fe@fedoraproject.org \
--to=code@musicinmybrain.net \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox