Revision: 48470
          http://brlcad.svn.sourceforge.net/brlcad/?rev=48470&view=rev
Author:   starseeker
Date:     2012-01-12 01:19:39 +0000 (Thu, 12 Jan 2012)
Log Message:
-----------
Fixed a crash condition in coil where the combination of the -S and -l options 
would result in an attempt to dereference a NULL variable.  CID 318

Modified Paths:
--------------
    brlcad/trunk/NEWS
    brlcad/trunk/src/shapes/coil.c

Modified: brlcad/trunk/NEWS
===================================================================
--- brlcad/trunk/NEWS   2012-01-12 01:03:16 UTC (rev 48469)
+++ brlcad/trunk/NEWS   2012-01-12 01:19:39 UTC (rev 48470)
@@ -13,6 +13,7 @@
 --- 2011-12-XX  Release 7.21.X                                     ---
 ----------------------------------------------------------------------
 
+* fix crash in coil when using -S and -l options - Cliff Yapp
 * fixed nirt memory leak and scriptfile off-by-one bug - Sean Morrison
 * d2-c now handles the imaginary part correctly - Erik Greenwald
 * fixed rt* crash when output file cannot be created - Erik Greenwald

Modified: brlcad/trunk/src/shapes/coil.c
===================================================================
--- brlcad/trunk/src/shapes/coil.c      2012-01-12 01:03:16 UTC (rev 48469)
+++ brlcad/trunk/src/shapes/coil.c      2012-01-12 01:19:39 UTC (rev 48470)
@@ -486,7 +486,8 @@
     /* If hard clamping the length, have to check some things and maybe clamp 
some values */
 
     if (!ZERO(overall_length)) {
-       bu_log("Caution:  Length clamping overrides other specified values - if 
supplied values are\ninconsistent with specified length, they will be overriden 
in this order:\n\nWhen Shrinking:  pitch, number of turns, wire diameter\nWhen 
Expanding:  number of turns, pitch\n\nCurrently, this override order is 
independent of whether the value is supplied by the user or 
calculated\ninternally - i.e. there is no preference for protecting user 
specified properties.\n");
+       bu_log("Caution:  Length clamping overrides other specified values - if 
supplied values are\ninconsistent with specified length, they will be overriden 
in this order:\n\nWhen Shrinking:  pitch, number of turns, wire diameter\nWhen 
Expanding:  number of turns, pitch\n\nCurrently, this override order is 
independent of whether the value is supplied by the user or 
calculated\ninternally - i.e. there is no preference for protecting user 
specified properties.\nAlso, length clamping will NOT override explicit section 
specification with -S\n");
+        if (coil_data) {
        if (start_cap_type != 0 || end_cap_type != 0) {
            bu_log("Note:  At this time only uncapped coils are allowed when 
length is constrained.\n");
            start_cap_type = 0;
@@ -524,7 +525,8 @@
                coil_data->nt--;
                coil_data->p = (overall_length - coil_data->wd)/coil_data->nt;
            }
-       }
+       } 
+        }
     }  
 
     /* Generate Name - this needs some thought for multiple section coils*/

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to