Commit Graph

1127 Commits

Author SHA1 Message Date
Jan Engelhardt
bb1d6f6f85 Resolve out-of-bounds access at start of level 10
Descent3/aipath.cpp:663:40: runtime error: index -1 out of bounds for type
'short unsigned int [5]'
2024-09-09 08:42:49 +02:00
Jan Engelhardt
10a03e71ef Resolve out-of-bounds access in GoalAllocSlot
(Happened during Retribution level 8 in the ship hangar with the docking clamps.)

Descent3/AIGoal.cpp:938:28: runtime error: index -1 out of bounds for type 'goal [10]'
2024-09-07 23:02:41 +02:00
Jan Engelhardt
31e9938eed Resolve out-of-bounds access in DrawSplinterObject
Occurs in Retribution level 7 whenever a FS440 "Six Gun" robot
is destroyed.

smfaces[facenum=0].texnum=-1
Descent3/splinter.cpp:73:74: runtime error: index -1 out of bounds for type "short int [35]"
2024-09-07 23:02:41 +02:00
Jan Engelhardt
76c8fa7038 Resolve out-of-bounds access in BOA
Descent3/BOA.cpp:451:53: runtime error: index -1 out of bounds for type 'float [40]'
2024-09-07 23:02:39 +02:00
Jan Engelhardt
ed91f6f411 Resolve signed integer overflow warning
Adding to ``total`` can cause signed integer overflow, which is
undefined, and ASAN warns:

Descent3/terrain.cpp:300:11: runtime error: signed integer overflow:
2147421608 + 65586 cannot be represented in type 'int'

Switch the variable unsigned; the bit patterns in practice will be
the same, but unsigned wraparound is well-defined. Finally, convert
the result back to signed, which should be allowed, cf.
http://eel.is/c++draft/conv.integral#3 .
2024-09-07 23:02:14 +02:00
Jan Engelhardt
0e9982fe72 Resolve signed multiplication overflow when drawing Omega gun fire
Descent3/WeaponFire.cpp:2130:7: runtime error: signed integer overflow:
520857 * 5000 cannot be represented in type "int"

This is about how the Omega's gun ray is animated, and given there is
some sine wave stuff going on, it is fair to say that the intent was
for the value to wraparound. However, wraparound in C++ is only
well-defined for unsigned types, so switch it.
2024-09-07 23:02:13 +02:00
Jan Engelhardt
765f616d7c Force makeshort/makeword to treat inputs as unsigned
ASAN says:

linux/lnxcontroller.cpp:484:12: runtime error: left shift of negative value -1
(in other words, "-1 << x", not "x << (-1)")

Bitwise AND/OR often only make sense for unsigned quantities, so
enforce exactly that kind of treatment.
2024-09-07 23:02:13 +02:00
Louis Gombert
9fcd4e7857
Merge pull request #558 from jengelh/crashes.2
Fix some 8 other game crashes [ASAN]
2024-09-07 21:57:49 +02:00
Louis Gombert
7c9fd48ea6
Merge pull request #566 from jengelh/scorch
Repair non-sensical scorch iterations
2024-09-07 21:49:34 +02:00
Louis Gombert
8c39002076
Merge pull request #567 from jengelh/spello
Fix a bunch of spellos in comments and strings
2024-09-07 21:48:51 +02:00
Jan Engelhardt
5f0bdf8184 Fix spello "it's" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
38b835a03b Fix spello "its" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
a3a31c77a2 Fix spello "seperate.." 2024-09-03 13:26:51 +02:00
Jan Engelhardt
4d9ff9cdc6 Fix some one-off spellos 2024-09-03 13:26:51 +02:00
Jan Engelhardt
1c32732f59 Fix spello "wierd" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
a09efdaf20 Fix spello "conforming" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
96c787bfb2 Fix spello "interative why" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
b14470bbff Fix spello "independan.." 2024-09-03 13:26:51 +02:00
Jan Engelhardt
1036c3c677 Fix spello "targett" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
edbde82918 Fix spello "agression" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
b88d7d4b7a Fix spello "recersive" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
762d0689fb Fix spello "visabil.." 2024-09-03 13:26:51 +02:00
Jan Engelhardt
ad9c2ba1d0 Fix spello "guarentee" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
234e666ce0 Fix spello "charactor" 2024-09-03 13:26:51 +02:00
Jan Engelhardt
337e8eaa17 Repair non-sensical scorch iterations
Gazing at my own code/modification, I find it is embarrasingly wrong.
Since ``sp`` is re-initialized at every loop iteration, setting it to
(the locally-constant) ``Scorch_start`` is incorrect. Make ``sp``
really mirror ``i`` at all times; this way, it also will not be
necessary anymore to update ``sp`` within the loop.

Fixes: 20ed30eef8
2024-09-03 00:09:39 +02:00
Louis Gombert
a4ef5fd0d5
Merge pull request #556 from winterheart/gamespy-reactivate
Reactivate Gamespy functionality
2024-09-02 23:18:07 +02:00
Louis Gombert
221a2abc53
Merge pull request #561 from tophyr/pr/osx-xattr
Add xattr command to OS X usage instructions
2024-09-02 23:06:55 +02:00
Jan Engelhardt
c3a6b1258c Resolve assertion when CollectorNomad2 dies
It is possible to cause the death of the CollectorNomad2 object (rush
to it before it possibly leaves again into the sidepackets the ship
won't fit through). The transition happens here:

```
f0  KillObject (objp=0x3d4d3e0 <Objects+384000>, killer=0x3cef7e0 <Objects>, damage=3) at /home/jengelh/D3/Descent3/damage.cpp:1036
f1  ApplyDamageToGeneric (hit_obj=0x3d4d3e0 <Objects+384000>, killer=0x3cef7e0 <Objects>, damage_type=6, damage=3, server_says=0, weapon_id=255) at /home/jengelh/D3/Descent3/damage.cpp:1401
f2  collide_generic_and_player (robotobj=0x3d4d3e0 <Objects+384000>, playerobj=0x3cef7e0 <Objects>, collision_point=0x7f877f40a830, collision_normal=0x7f877f40a858, f_reverse_normal=true, hit_info=0x7f877f40a810) at /home/jengelh/D3/physics/collide.cpp:2127
f3  collide_two_objects (A=0x3cef7e0 <Objects>, B=0x3d4d3e0 <Objects+384000>, collision_point=0x7f877f40a830, collision_normal=0x7f877f40a858, hit_info=0x7f877f40a810) at /home/jengelh/D3/physics/collide.cpp:2505
f4  do_physics_sim (obj=0x3cef7e0 <Objects>) at /home/jengelh/D3/physics/physics.cpp:1515
f5  ObjDoFrame (obj=0x3cef7e0 <Objects>) at /home/jengelh/D3/Descent3/object.cpp:2824
f6  ObjDoFrameAll () at /home/jengelh/D3/Descent3/object.cpp:2988
f7  GameFrame () at /home/jengelh/D3/Descent3/GameLoop.cpp:2980
f8  GameSequencer () at /home/jengelh/D3/Descent3/gamesequence.cpp:1221
f9  PlayGame () at /home/jengelh/D3/Descent3/game.cpp:834
f10 MainLoop () at /home/jengelh/D3/Descent3/descent.cpp:550
f11 Descent3 () at /home/jengelh/D3/Descent3/descent.cpp:508
f12 oeD3LnxApp::run (this=0x7f877f00db50) at /home/jengelh/D3/Descent3/sdlmain.cpp:151

<frame 2> (gdb) p robotobj
$1 = {
	type = 2 '\002' (OBJ_ROBOT), dummy_type = 255 '\377', id = 276,
	flags = 2135072, name = 0x5020000aff30 "CollectorNomad2",
	handle = 2432, next = 178, prev = -1,
	control_type = 1 '\001' (CT_AI), movement_type = 2 '\002' (MC_ROLLING),
	render_type = 1 '\001' (LRT_GOURAUD), lighting_render_type = 1 '\001', roomnum = 58,
	pos = {x = 2350.21484, y = -263.523956, z = 1868.59888},
	orient = {
		rvec = {x = 0.882905424, y = 1.63964216e-14, z = -0.469550878},
		uvec = {x = -1.25793295e-14, y = 1, z = 1.12662192e-14},
		fvec = {x = 0.469550878, y = -4.04037088e-15, z = 0.882905424}
	},...}
```

Thus, KillObject sets obj->control_type=CT_DYING. In the same game
tick, Level6.cpp then calls aAIGoalFollowPathSimple which triggers
the assertion.

```
Int3 in $GIT/Descent3/osiris_predefs.cpp at line 571.(Descent 3 Debug Break)

f0  osipf_AIGoalFollowPathSimple (objhandle=2432, path_id=21, guid=7, flags=1052928, slot=3) at $GIT/Descent3/osiris_predefs.cpp:571
f1  AI_GoalFollowPathSimple (objhandle=2432, path_id=21, guid=7, flags=1052928, slot=3) at $GIT/scripts/osiris_import.h:170
f2  aAIGoalFollowPathSimple (objhandle=2432, pathid=21, flags=1052928, goalid=7, priority=3) at $GIT/scripts/DallasFuncs.cpp:3649
f3  LevelScript_0000::CallEvent (this=0x5020000ba430, event=256, data=0x7f963e71d930) at $GIT/scripts/Level6.cpp:2465
f4  CallInstanceEvent (id=0, ptr=0x5020000ba430, event=256, data=0x7f963e71d930) at $GIT/scripts/Level6.cpp:2209
f5  Osiris_CallLevelEvent (event=256, data=0x7f963e71d930) at $GIT/Descent3/OsirisLoadandBind.cpp:2000
f6  GameFrame () at $GIT/Descent3/GameLoop.cpp:3020
f7  GameSequencer () at $GIT/Descent3/gamesequence.cpp:1221
f8  PlayGame () at $GIT/Descent3/game.cpp:834
f9  MainLoop () at $GIT/Descent3/descent.cpp:550
f10 Descent3 () at $GIT/Descent3/descent.cpp:508
f11 oeD3LnxApp::run (this=0x7f963e80db50) at $GIT/Descent3/sdlmain.cpp:151
```
2024-09-02 22:53:27 +02:00
Louis Gombert
fb6573e1b0
Merge pull request #562 from winterheart/ps_rand-fixes
Fixes to RNG-related functions
2024-09-02 22:23:27 +02:00
Louis Gombert
dd6e684712
Merge pull request #555 from jengelh/collide
Resolve out-of-bounds in PolyCollideObject [ASAN]
2024-09-02 21:03:32 +02:00
Louis Gombert
97efd520a7
Merge pull request #554 from jengelh/align
Resolve some non-fatal ASAN reports about alignment
2024-09-02 20:57:02 +02:00
Louis Gombert
0800723af8
Merge pull request #553 from jengelh/master
Fix 13 different crashes [ASAN]
2024-09-02 20:44:05 +02:00
Louis Gombert
9df3316bd9
Merge pull request #552 from winterheart/mve-pipewire
Fix audio distortions on MVE playback with pipewire backend
2024-09-02 20:31:58 +02:00
Azamat H. Hackimov
32286ded46 Don't mix D3_RAND_MAX and rand()
rand() gives numbers in range [0, RAND_MAX] (INT_MAX, 0x7fffffff) while D3_RAND_MAX is only 0x7fff.
2024-09-02 16:19:15 +03:00
Azamat H. Hackimov
ddc6fd0857 Fix lightning effect probability
For lightning effect we using ps_rand() function which expects number in range [0, 0x7fff], but RAND_MAX is 0x7fffffff (INT_MAX, for 64-bit systems). In result lightnings strikes on every allowed frame and leads to epilepsy.
2024-09-02 16:07:36 +03:00
Chris Sarbora
3c406beb16
Add xattr command to OS X usage instructions 2024-09-02 00:08:53 -07:00
Jan Engelhardt
819e20955e Resolve out-of-bounds access in AutoSelectWeapon
$GIT/Descent3/weapon.cpp:1327:47: runtime error: index 32784 out of bounds for type "otype_wb_info [21]"

Do not compute &static_wb[index] before index has been checked for
sentinel values.
2024-08-31 12:13:44 +02:00
Jan Engelhardt
e90eb6de7d Resolve out-of-bounds access in CollideSubmodelFacesUnsorted
physics/newstyle_fi.cpp:166:50: runtime error: index -1 out of bounds for type "short int [35]"
2024-08-31 12:13:44 +02:00
Jan Engelhardt
f4d1e6549b Resolve out-of-bounds access in AddMultipleLinesToHUDMessages
When trying to use the Collector's Icon from level 6 anywhere where
it is not usable:

$GIT/Descent3/hudmessage.cpp:508:36: runtime error: index 18446744073709551615 out of bounds for type 'char [400]'
=================================================================
==59139==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000003c2b4ff at pc 0x0000007786d6 bp 0x7fffbf4dde00 sp 0x7fffbf4dddf8
READ of size 1 at 0x000003c2b4ff thread T0
    f0 in AddMultipleLinesToHUDMessages $GIT/Descent3/hudmessage.cpp:508
    f1 in AddColoredHUDMessage(unsigned int, char const*, ...) $GIT/Descent3/hudmessage.cpp:536
    f2 in msafe_CallFunction(unsigned char, msafe_struct*) $GIT/Descent3/multisafe.cpp:2034
    f3 in aShowHUDMessageObj(char const*, int, ...) $GIT/scripts/DallasFuncs.cpp:1261
    f4 in CustomObjectScript_206F::CallEvent(int, tOSIRISEventInfo*) $GIT/scripts/Level6.cpp:3052
    f5 in CallInstanceEvent $GIT/scripts/Level6.cpp:2209
    f6 in Osiris_CallEvent(object*, int, tOSIRISEventInfo*) $GIT/Descent3/OsirisLoadandBind.cpp:2203
    f7 in Inventory::Use(int, int, object*) $GIT/Descent3/Inventory.cpp:822
    f8 in Inventory::UsePos(object*) $GIT/Descent3/Inventory.cpp:875
    f9 in UseInventoryItem() $GIT/Descent3/Inventory.cpp:1503
    f10 DoKeyboardMisc $GIT/Descent3/Controls.cpp:1234
    f11 DoMisc $GIT/Descent3/Controls.cpp:1114
    f12 ReadPlayerControls(game_controls*) $GIT/Descent3/Controls.cpp:737
    f13 DoFlyingControl(object*) $GIT/Descent3/object.cpp:2325
    f14 ObjDoFrame(object*) $GIT/Descent3/object.cpp:2668
    f15 ObjDoFrameAll() $GIT/Descent3/object.cpp:2988
    f16 GameFrame() $GIT/Descent3/GameLoop.cpp:2980
    f17 GameSequencer() $GIT/Descent3/gamesequence.cpp:1221
    f18 PlayGame() $GIT/Descent3/game.cpp:834
    f19 MainLoop() $GIT/Descent3/descent.cpp:550
    f20 Descent3() $GIT/Descent3/descent.cpp:508
    f21 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151

0x000003c2b4ff is located 62 bytes after global variable 'Hud_messages_paused' defined in '$GIT/Descent3/hudmessage.cpp:400:13' (0x3c2b4c0) of size 1
  'Hud_messages_paused' is ascii string ''
2024-08-31 12:13:44 +02:00
Jan Engelhardt
2a5789165a Resolve out-of-bounds access in AIDoOrient
Descent3/AImain.cpp:4442:43: runtime error: index -1 out of bounds for type 'goal [10]'
2024-08-31 12:13:44 +02:00
Jan Engelhardt
06c2aba0ae Resolve use-after-free when releasing GuideBot via "Use Inventory"
The GuideBot can be released from the ship either by using the F4
menu and selecting release, or by exercising the Use Inventory hotkey
(normally '\'). The ``GuideBot`` class near ``case GBM_BIRTH:``
strips the inventory item, which leaves the ``node`` pointer in
Inventory::Use dangling.

==52439==ERROR: AddressSanitizer: heap-use-after-free on address 0x507000086758 at pc 0x0000008499cb bp 0x7ffe4ca6bcc0 sp 0x7ffe4ca6bcb8
READ of size 4 at 0x507000086758 thread T0
    f0 Inventory::Use(int, int, object*) $GIT/Descent3/Inventory.cpp:817
    f1 Inventory::UsePos(object*) $GIT/Descent3/Inventory.cpp:868
    f2 UseInventoryItem() $GIT/Descent3/Inventory.cpp:1496
    f3 DoKeyboardMisc $GIT/Descent3/Controls.cpp:1234
    f4 DoMisc $GIT/Descent3/Controls.cpp:1114
    f5 ReadPlayerControls(game_controls*) $GIT/Descent3/Controls.cpp:737
    f6 DoFlyingControl(object*) $GIT/Descent3/object.cpp:2325
    f7 ObjDoFrame(object*) $GIT/Descent3/object.cpp:2668
    f8 ObjDoFrameAll() $GIT/Descent3/object.cpp:2988
    f9 GameFrame() $GIT/Descent3/GameLoop.cpp:2980
    f10 GameSequencer() $GIT/Descent3/gamesequence.cpp:1221
    f11 PlayGame() $GIT/Descent3/game.cpp:834
    f12 MainLoop() $GIT/Descent3/descent.cpp:555
    f13 Descent3() $GIT/Descent3/descent.cpp:508
    f14 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151

0x507000086758 is located 8 bytes inside of 80-byte region [0x507000086750,0x5070000867a0)
freed by thread T0 here:
    f0 operator delete(void*, unsigned long) (/lib64/libasan.so.8+0xfe1f8) (BuildId: 5615a04b8d0a5a8eafa661f7235e2d98fa2b9137)
    f1 Inventory::RemoveNode(inven_item*) $GIT/Descent3/Inventory.cpp:940
    f2 Inventory::Remove(int, int) $GIT/Descent3/Inventory.cpp:898
    f3 msafe_CallFunction(unsigned char, msafe_struct*) $GIT/Descent3/multisafe.cpp:2201
    f4 GuideBot::SetMode(int, char) $GIT/scripts/AIGame.cpp:4771
    f5 GuideBot::DoInit(int, bool) $GIT/scripts/AIGame.cpp:5768
    f6 GuideBot::DoExternalCommands(int, gb_com*, int) $GIT/scripts/AIGame.cpp:5032
    f7 GuideBot::DoNotify(int, tOSIRISEventInfo*) $GIT/scripts/AIGame.cpp:5779
    f8 GuideBot::CallEvent(int, tOSIRISEventInfo*) $GIT/scripts/AIGame.cpp:6246
    f9 CallInstanceEvent $GIT/scripts/AIGame.cpp:2767
    f10 Osiris_CallEvent(object*, int, tOSIRISEventInfo*) $GIT/Descent3/OsirisLoadandBind.cpp:2256
    f11 osipf_CallObjectEvent(int, int, tOSIRISEventInfo*) $GIT/Descent3/osiris_predefs.cpp:485
    f12 GuideBot::DoUse(int) $GIT/scripts/AIGame.cpp:5685
    f13 GuideBot::CallEvent(int, tOSIRISEventInfo*) $GIT/scripts/AIGame.cpp:6249
    f14 CallInstanceEvent $GIT/scripts/AIGame.cpp:2767
    f15 Osiris_CallEvent(object*, int, tOSIRISEventInfo*) $GIT/Descent3/OsirisLoadandBind.cpp:2256
    f16 Inventory::Use(int, int, object*) $GIT/Descent3/Inventory.cpp:815

previously allocated by thread T0 here:
    f0 operator new(unsigned long) (/lib64/libasan.so.8+0xfd2f8) (BuildId: 5615a04b8d0a5a8eafa661f7235e2d98fa2b9137)
    f1 Inventory::AddObjectItem(int, int, int, int, int, char const*) $GIT/Descent3/Inventory.cpp:616
    f2 Inventory::Add(int, int, object*, int, int, int, char const*) $GIT/Descent3/Inventory.cpp:517
    f3 InitPlayerNewLevel(int) $GIT/Descent3/Player.cpp:1460
    f4 StartLevel() $GIT/Descent3/gamesequence.cpp:1595
    f5 LoadAndStartCurrentLevel() $GIT/Descent3/gamesequence.cpp:1675
    f6 GameSequencer() $GIT/Descent3/gamesequence.cpp:1197
    f7 PlayGame() $GIT/Descent3/game.cpp:834
    f8 MainLoop() $GIT/Descent3/descent.cpp:555
    f9 Descent3() $GIT/Descent3/descent.cpp:508
    f10 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151
2024-08-31 12:13:44 +02:00
Jan Engelhardt
97eeab914b Resolve out-of-bounds access in _splitpath
Crash at the start of every level.

==43628==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x5020000c5a6f at pc 0x7efd39f3868a bp 0x7ffe5a39ec80 sp 0x7ffe5a39ec78
READ of size 1 at 0x5020000c5a6f thread T0
    f0 _splitpath(char const*, char*, char*, char*, char*) $GIT/scripts/linux_lib.cpp:37
    f1 InitializeDLL $GIT/scripts/level1.cpp:705
    f2 Osiris_LoadLevelModule(char*) $GIT/Descent3/OsirisLoadandBind.cpp:1095
    f3 InitLevelScript() $GIT/Descent3/Mission.cpp:1699
    f4 StartLevel() $GIT/Descent3/gamesequence.cpp:1622
    f5 LoadAndStartCurrentLevel() $GIT/Descent3/gamesequence.cpp:1675
    f6 GameSequencer() $GIT/Descent3/gamesequence.cpp:1197
    f7 PlayGame() $GIT/Descent3/game.cpp:834
    f8 MainLoop() $GIT/Descent3/descent.cpp:555
    f9 Descent3() $GIT/Descent3/descent.cpp:508
    f10 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151

0x5020000c5a6f is located 1 bytes before 7-byte region [0x5020000c5a70,0x5020000c5a77)
allocated by thread T0 here:
    f0 strdup (/lib64/libasan.so.8+0xf68e0) (BuildId: 5615a04b8d0a5a8eafa661f7235e2d98fa2b9137)
    f1 Osiris_LoadLevelModule(char*) $GIT/Descent3/OsirisLoadandBind.cpp:1046
    f2 InitLevelScript() $GIT/Descent3/Mission.cpp:1699
    f3 StartLevel() $GIT/Descent3/gamesequence.cpp:1622
    f4 LoadAndStartCurrentLevel() $GIT/Descent3/gamesequence.cpp:1675
    f5 GameSequencer() $GIT/Descent3/gamesequence.cpp:1197
    f6 PlayGame() $GIT/Descent3/game.cpp:834
    f7 MainLoop() $GIT/Descent3/descent.cpp:555
    f8 Descent3() $GIT/Descent3/descent.cpp:508
    f9 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151
2024-08-31 12:13:44 +02:00
Jan Engelhardt
541ca70b00 Resolve out-of-bounds access when showing ship's log
When '\n' is placed, the '\0' is overwritten but no new \0 is placed,
causing strlen() in the next loop iteration to go beyond the
boundaries of m_buffer.

Happens at the start of level 5, or later in level 1, basically
whenever there are at least two lines in m_msg.

==74575==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x51d0003e8880 at pc 0x7f6a08c80c66 bp 0x7ffd4edb46e0 sp 0x7ffd4edb3ea0
READ of size 2353 at 0x51d0003e8880 thread T0
    f0 __interceptor_strlen (/lib64/libasan.so.8+0x80c65) (BuildId: 5615a04b8d0a5a8eafa661f7235e2d98fa2b9137)
    f1 MsgListConsole::Open(char const*, int, int, int, int) $GIT/Descent3/hudmessage.cpp:1644
    f2 OpenGameMessageConsole() $GIT/Descent3/hudmessage.cpp:1532
    f3 ToggleGameMessageConsole() $GIT/Descent3/hudmessage.cpp:1523
    f4 ProcessNormalKey(int) $GIT/Descent3/GameLoop.cpp:1257
    f5 ProcessKeys() $GIT/Descent3/GameLoop.cpp:2410
    f6 GameFrame() $GIT/Descent3/GameLoop.cpp:2963
    f7 GameSequencer() $GIT/Descent3/gamesequence.cpp:1221
    f8 PlayGame() $GIT/Descent3/game.cpp:834
    f9 MainLoop() $GIT/Descent3/descent.cpp:550
    f10 Descent3() $GIT/Descent3/descent.cpp:508
    f11 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151

0x51d0003e8880 is located 0 bytes after 2048-byte region [0x51d0003e8080,0x51d0003e8880)
allocated by thread T0 here:
    f0 malloc (/lib64/libasan.so.8+0xfc7d7) (BuildId: 5615a04b8d0a5a8eafa661f7235e2d98fa2b9137)
    f1 MsgListConsole::Open(char const*, int, int, int, int) $GIT/Descent3/hudmessage.cpp:1629
2024-08-31 12:13:44 +02:00
Jan Engelhardt
cb5c2913b2 Resolve out-of-bounds access in fvi_room
Possibly fixes #530.

physics/findintersection.cpp:4711:64: runtime error: index -1 out of bounds for type 'fvi_face_room_list [200]'
=================================================================
SIGNAL 11 caught, aborting
2024-08-31 11:21:09 +02:00
Jan Engelhardt
6fd084b75d Resolve alignment issues and type-punning in multi_external.h
$GIT/Descent3/multi_external.h:286:31: runtime error: store to misaligned address 0x7f3f760a3041 for type 'int16_t', which requires 2 byte alignment
$GIT/Descent3/multi_external.h:291:32: runtime error: store to misaligned address 0x7f3f760a3043 for type 'uint16_t', which requires 2 byte alignment
2024-08-31 10:49:35 +02:00
Jan Engelhardt
e1af53bbcc Resolve RoomMemAlloc returning misaligned pointers
$GIT/Descent3/room.cpp:629:28: runtime error: member access within misaligned address 0x7fde8b011d6e for type 'struct roomUVL', which requires 4 byte alignment
$GIT/Descent3/LoadLevel.cpp:1978:24: runtime error: member access within misaligned address 0x7fde8b011d6e for type 'struct roomUVL', which requires 4 byte alignment
$GIT/Descent3/room.cpp:608:13: runtime error: member access within misaligned address 0x7fde8b0243d4 for type 'struct face', which requires 8 byte alignment
$GIT/vecmat/vector.cpp:180:18: runtime error: member access within misaligned address 0x7fde8b03dfda for type 'const struct vector', which requires 4 byte alignment
$GIT/Descent3/BOA.cpp:1213:27: runtime error: member access within misaligned address 0x7fde8b0243d4 for type 'struct face', which requires 8 byte alignment

RoomMemAlloc failed to aligned returned pointers to the type they are
being used for.
2024-08-31 10:49:33 +02:00
Azamat H. Hackimov
cd0a6f961c Fix Windows building 2024-08-30 22:05:33 +03:00
Azamat H. Hackimov
4d849d860c Simplify gamespy code
Don't decrypt 'secret' code as it no secret anymore.
2024-08-30 16:10:41 +03:00
Azamat H. Hackimov
3687c49091 Fix gamespy 'validate' response
Empty buffer check prevents to correctly validate 'secure' requests from tracker, commenting out check.
Minor enhancements and fixes.
2024-08-30 15:38:24 +03:00
Jan Engelhardt
9e03622b24 Resolve out-of-bounds in PolyCollideObject
(Observed in Retribution level 7 while interacting with an Old
Scratch robot.) Potentially might fix issue #530.

fvi_moveobj=-1
fvi_moveobj=101
fvi_moveobj=235
fvi_moveobj=374
fvi_moveobj=-378
fvi_moveobj=-378
fvi_moveobj=-374
==59260==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000003c8f058 at pc 0x0000012857fc bp 0x7ffffb094c50 sp 0x7ffffb094c48
READ of size 1 at 0x000003c8f058 thread T0
    f0  PolyCollideObject(object*) $GIT/physics/newstyle_fi.cpp:370
    f1  check_hit_obj(int) $GIT/physics/findintersection.cpp:3483
    f2  fvi_rooms_objs $GIT/physics/findintersection.cpp:4398
    f3  fvi_FindIntersection(fvi_query*, fvi_info*, bool) $GIT/physics/findintersection.cpp:2812
    f4 AquireElectricalTarget(object*) $GIT/Descent3/WeaponFire.cpp:1189
    f5 CreateAndFireWeapon(vector*, vector*, object*, int) $GIT/Descent3/WeaponFire.cpp:1326
    f6 FireWeaponFromObject(object*, int, int, bool, bool) $GIT/Descent3/WeaponFire.cpp:1887
    f7 WBFireBattery(object*, otype_wb_info*, int, int, float) $GIT/Descent3/robotfire.cpp:149
    f8 FireWeaponFromPlayer(object*, int, int, bool, float) $GIT/Descent3/WeaponFire.cpp:3004
    f9 DoFlyingControl(object*) $GIT/Descent3/object.cpp:2450
    f10 ObjDoFrame(object*) $GIT/Descent3/object.cpp:2668
    f11 ObjDoFrameAll() $GIT/Descent3/object.cpp:2988
    f12 GameFrame() $GIT/Descent3/GameLoop.cpp:2980
    f13 GameSequencer() $GIT/Descent3/gamesequence.cpp:1221
    f14 PlayGame() $GIT/Descent3/game.cpp:834
    f15 MainLoop() $GIT/Descent3/descent.cpp:555
    f16 Descent3() $GIT/Descent3/descent.cpp:508
    f17 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151

0x000003c8f058 is located 52 bytes after global variable 'last_heartbeat' defined in '$GIT/Descent3/multi.cpp:9459:16' (0x3c8f020) of size 4
0x000003c8f058 is located 8 bytes before global variable 'guard variable for MultiSendHeartbeat()::last_heartbeat' defined in '$GIT/Descent3/multi.cpp:9459:16' (0x3c8f060) of size 8
2024-08-30 05:25:11 +02:00