libredwg
[Top][All Lists]
Advanced

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

Re: [libredwg] [patch #8074] Segmentation fault on unsupported version o


From: Avneet Kaur
Subject: Re: [libredwg] [patch #8074] Segmentation fault on unsupported version of dwg files
Date: Thu, 4 Jul 2013 23:54:26 +0530

On Fri, Jun 14, 2013 at 8:14 PM, Gaganjyot <address@hidden> wrote:
>
> This patch removes the segmentation fault error that is due to non supported
> versions of DWG files. This checks the DWG file version and if not supported
> exits with printing "Version not supported". This patch can be merged into
> git.


Hello Gagan!

You have submitted two patches for the same purpose as following:
1. file #28317
2. file #28316

As I reviewed and tested the first patch, It's not conveying the above
mentioned purpose.
And the second one is right, but not in terms of efficiency.
It checks for every if condition that affecting the performance.


/*******************************************************************************************/

 if(4==dwg_data->header.version)
    {
      printf("The Version 2004 is not properly supported yet.\nProgram
exiting! \n");
      exit(1);
    }

  if(5==dwg_data->header.version)
    {
      printf("The Version 2007 is not properly supported yet.\nProgram
exiting! \n");
      exit(1);
    }

  if(0==dwg_data->header.version)
    {
      printf("This Version is not properly supported yet.\nProgram
exiting! \n");
      exit(1);
    }


/**************************************************************************************/

I think you should use switch or if - else, instead.


--
Avneet Kaur
www.avneetkhasla.wordpress.com



reply via email to

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