Source Code Project Mantis - FSSCP
View Issue Details
0002564FSSCPmath-relatedpublic2012-01-13 19:062012-01-15 06:17
ReporterEchelon9 
Assigned ToEchelon9 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
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 Filespatch preLaunchSndFix.svn.patch (574) 2012-01-15 05:44
http://scp.indiegames.us/mantis/file_download.php?file_id=1745&type=bug

Notes
(0013047)
Echelon9   
2012-01-14 19:59   
Fixed in revision 8209
(0013052)
Zacam   
2012-01-15 05:33   
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   
2012-01-15 05:44   
attached fix
(0013055)
Echelon9   
2012-01-15 06:12   
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   
2012-01-15 06:17   
Related issue that was uncovered has been fixed in 8228.

Issue History
2012-01-13 19:06Echelon9New Issue
2012-01-13 19:06Echelon9Statusnew => assigned
2012-01-13 19:06Echelon9Assigned To => Echelon9
2012-01-14 19:59Echelon9Note Added: 0013047
2012-01-14 19:59Echelon9Statusassigned => resolved
2012-01-14 19:59Echelon9Fixed in Version => 3.6.14 RC2
2012-01-14 19:59Echelon9Resolutionopen => fixed
2012-01-15 05:33ZacamNote Added: 0013052
2012-01-15 05:33ZacamStatusresolved => feedback
2012-01-15 05:33ZacamResolutionfixed => reopened
2012-01-15 05:44Eli2File Added: preLaunchSndFix.svn.patch
2012-01-15 05:44Eli2Note Added: 0013053
2012-01-15 06:12Echelon9Note Added: 0013055
2012-01-15 06:12Echelon9Statusfeedback => assigned
2012-01-15 06:17Echelon9Note Added: 0013056
2012-01-15 06:17Echelon9Statusassigned => resolved
2012-01-15 06:17Echelon9Resolutionreopened => fixed