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

Bug#569644: antennavis TkAnt crashes if no GW lines present in antenna file



Package: antennavis
Version: 0.3-6
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu karmic ubuntu-patch


Originally reported by [jsefija@gmail.com] as
https://bugs.launchpad.net/ubuntu/+source/antennavis/+bug/120923

Loading an antenna file (or any file) which contains no "GW" geometry
tube lines causes antennavis TkAnt to crash with segmentation fault.

Easy to reproduce:
1. $ touch /tmp/empty.nec
2. $ antennavis
3. Load File "/tmp/empty.nec" --> TkAnt: Segmentation fault

Attached patch fixes the bug.
--- antennavis-0.3.orig/pcard.c
+++ antennavis-0.3/pcard.c
@@ -564,6 +564,13 @@
     }  /**  For each card  **/
     fclose(fin);
 
+    /**  Check whether we read any tubes at all before proceeding. **/
+    if ( antData->first_tube == NULL ) {
+      fprintf(stderr, "No geometry tubes (GW lines) specified in file %s\n",
+              file_name);
+      return;
+    }
+
     /**  Traverse list of elements to find dynamic range  **/
     /**  We will need to scale things to accomodate all   **/
     /**  sizes of antennas.                               **/

Reply to: