Currently, "testSVG sample.dwg" segfaults: |./testSVG sample.dwg |<?xml version="1.0" encoding="UTF-8" standalone="no"?> |<svg | xmlns:svg="http://www.w3.org/2000/svg" | xmlns="http://www.w3.org/2000/svg" | xmlns:xlink="http://www.w3.org/1999/xlink" | version="1.1" | width="270.030212" | height="280.023651" |> | <defs> | <g id="symbol-85" > | <!-- *Paper_Space --> | </g> | |Compilation segmentation fault at Tue Feb 23 13:20:02
With the patch below, there is no segfault: |$ ./testSVG sample.dwg |<?xml version="1.0" encoding="UTF-8" standalone="no"?> |<svg | xmlns:svg="http://www.w3.org/2000/svg" | xmlns="http://www.w3.org/2000/svg" | xmlns:xlink="http://www.w3.org/1999/xlink" | version="1.1" | width="270.030212" | height="280.023651" |> | <defs> | <g id="symbol-85" > | <!-- *Paper_Space --> | </g> |Found null ref->obj->tio.object | </defs> | <g id="symbol-31" > | <!-- *Model_Space --> | <circle id="dwg-object-44" cx="250.002307" cy="170.006558" r="20.000000" fill="none" stroke="blue" stroke-width="0.1px" /> | <text id="dwg-object-45" x="0.002307" y="60.006558" font-family="Verdana" font-size="5.000000" fill="blue">Jen teksto simpla, cxu ne?</text> | <path id="dwg-object-47" d="M 150.002307,100.006558 250.002307,100.006558" style="fill:none;stroke:blue;stroke-width:0.1px" /> | <path id="dwg-object-48" d="M 250.002307,0.006558 250.002307,100.006558" style="fill:none;stroke:blue;stroke-width:0.1px" /> | <path id="dwg-object-49" d="M 150.002307,100.006558 250.002307,0.006558" style="fill:none;stroke:blue;stroke-width:0.1px" /> | </g> | <g id="symbol-80" > | <!-- *Paper_Space --> | </g> |</svg> Is this patch correct? thi ____________________________________________________________________ examples/testSVG.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/examples/testSVG.c b/examples/testSVG.c index 999a951..377fae6 100644 --- a/examples/testSVG.c +++ b/examples/testSVG.c @@ -200,6 +200,12 @@ void output_BLOCK_HEADER(Dwg_Object_Ref* ref) return; } + if (!ref->obj->tio.object) + { + fprintf(stderr, "Found null ref->obj->tio.object\n"); + return; + } + hdr = ref->obj->tio.object->tio.BLOCK_HEADER; printf( "\t<g id=\"symbol-%lu\" >\n\t\t<!-- %s -->\n", ref->absolute_ref, hdr->entry_name);