libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libredwg] crash on testSVG sample.dwg


From: Felipe Sanches
Subject: Re: [libredwg] crash on testSVG sample.dwg
Date: Tue, 23 Feb 2010 12:50:09 -0300

I think it is correct in the sense of being defensive coding ("let's
avoid crashes and warn about strange conditions reached"). But it does
not solve the issue. Because I think there must be a reason for that
pointer to be null. Are we missing something? You can apply this
patch, but we need to figure out later what is wrong with this null
pointer.

Felipe

On Tue, Feb 23, 2010 at 9:23 AM, Thien-Thi Nguyen <address@hidden> wrote:
> 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);
>
>
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]