2019-12-07 11:56 EST


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002564FSSCPmath-relatedpublic2012-01-15 06:17
ReporterEchelon9 
Assigned ToEchelon9 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version3.6.14 RC2 
Target Version3.6.14 RC2Fixed in Version3.6.14 RC2 
Summary0002564: GCC warning: Use of NULL in arithmetic operation in ship.cpp (winfo_p->pre_launch_snd != NULL)
DescriptionA NULL comparison check here is incorrect, as we are checking against an int not a pointer.

The correct check is against the value assigned to pre_launch_snd when a nonexistent sound was provided from the tables.

The table parsing ultimately calls parse_sound_core():

Warning(LOCATION, "%s sound index out of range on '%s'. Must be between 0 and %d. Forcing to -1 (Nonexistent sound).\n", tag, object_name, size_to_check);
TagsNo tags attached.
Attached Files
  • patch file icon preLaunchSndFix.svn.patch (574 bytes) 2012-01-15 05:44 -
    Index: code/weapon/weapons.cpp
    ===================================================================
    --- code/weapon/weapons.cpp
    +++ code/weapon/weapons.cpp
    @@ -856,11 +856,14 @@ void init_weapon_entry(int weap_info_index)
     	wip->catchup_pixels_per_sec = 50;
     	wip->catchup_pixel_penalty = 50;
     	wip->seeker_strength = 1.0f;
    -	
    +
     	wip->swarm_count = -1;
     	// *Default is 150  -Et1
     	wip->SwarmWait = SWARM_MISSILE_DELAY;
     	
    +	wip->pre_launch_snd = -1;
    +	wip->pre_launch_snd_min_interval = 0;
    +
     	wip->launch_snd = -1;
     	wip->impact_snd = -1;
     	wip->disarmed_impact_snd = -1;
    
    patch file icon preLaunchSndFix.svn.patch (574 bytes) 2012-01-15 05:44 +

-Relationships
+Relationships

-Notes

~0013047

Echelon9 (developer)

Fixed in revision 8209

~0013052

Zacam (administrator)

Apparently, -1 in place of NULL causes Primary Weapons fire to play the Missile Lock On sound instead. (Only for single shots, press and hold to repeat fire, and the actual primary weapon sfx comes through)

~0013053

Eli2 (developer)

attached fix

~0013055

Echelon9 (developer)

The NULL to -1 change has revealed a related bug in init_weapon_entry() which Eli2 has helpfully provided a patch for -- that patch should be good to go in trunk.

~0013056

Echelon9 (developer)

Related issue that was uncovered has been fixed in 8228.
+Notes

-Issue History
Date Modified Username Field Change
2012-01-13 19:06 Echelon9 New Issue
2012-01-13 19:06 Echelon9 Status new => assigned
2012-01-13 19:06 Echelon9 Assigned To => Echelon9
2012-01-14 19:59 Echelon9 Note Added: 0013047
2012-01-14 19:59 Echelon9 Status assigned => resolved
2012-01-14 19:59 Echelon9 Fixed in Version => 3.6.14 RC2
2012-01-14 19:59 Echelon9 Resolution open => fixed
2012-01-15 05:33 Zacam Note Added: 0013052
2012-01-15 05:33 Zacam Status resolved => feedback
2012-01-15 05:33 Zacam Resolution fixed => reopened
2012-01-15 05:44 Eli2 File Added: preLaunchSndFix.svn.patch
2012-01-15 05:44 Eli2 Note Added: 0013053
2012-01-15 06:12 Echelon9 Note Added: 0013055
2012-01-15 06:12 Echelon9 Status feedback => assigned
2012-01-15 06:17 Echelon9 Note Added: 0013056
2012-01-15 06:17 Echelon9 Status assigned => resolved
2012-01-15 06:17 Echelon9 Resolution reopened => fixed
+Issue History