View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002828 | FSSCP | public | 2013-03-30 03:05 | 2013-04-13 07:07 | |
Reporter | Echelon9 | Assigned To | Echelon9 | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.19 | ||||
Target Version | 3.7.0 | ||||
Summary | 0002828: AddressSanitizer: global-buffer-overflow in ship_subsys_disrupted() ship.cpp:8066 | ||||
Description | Reported by AddressSanitizer, a memory error detector for C/C++, in FS2Open builds based on trunk r9610. ERROR: AddressSanitizer: global-buffer-overflow on address 0x000103b8a070 at pc 0x1020848a2 bp 0x7fff5fbfc2b0 sp 0x7fff5fbfc2a8 READ of size 4 at 0x000103b8a070 thread T0 #0 0x1020848a1 in ship_subsys_disrupted ship.cpp:8066 0000001 0x100a7a8b0 in hud_update_ship_status hudtargetbox.cpp:2052 0000002 0x100db2b5d in hud_update_frame hud.cpp:1605 0000003 0x1002ea391 in game_simulation_frame freespace.cpp:4025 0000004 0x1002eec01 in game_frame freespace.cpp:4380 0000005 0x1002f43eb in game_do_frame freespace.cpp:4791 0000006 0x1002fff4a in game_do_state freespace.cpp:6466 0000007 0x1008f18a9 in gameseq_process_events gamesequence.cpp:405 0000008 0x1003067c8 in game_main freespace.cpp:7033 0000009 0x100307e36 in SDL_main freespace.cpp:7167 ... /** * Determine if a given type of subsystem is disrupted (i.e. inoperable) * * @param sp pointer to ship containing subsystem * @param type type of subsystem (SUBSYSTEM_*) * @return 1 if subsystem is disrupted, 0 if subsystem is not disrupted */ int ship_subsys_disrupted(ship *sp, int type) { Assert ( sp != NULL ); Assert ( type >= 0 && type < SUBSYSTEM_MAX ); // Bogus pointer to ship to check for disrupted subsystem if (sp == NULL) return 0; if ( sp->subsys_disrupted_flags & (1<<type) ) { <======= return 1; } else { return 0; } } | ||||
Steps To Reproduce | 1. Utilise a version of Clang that supports AddressSantizer (https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer). 2. Build with -fsanitize=address C/C++ flag 3. Run the game with mediavps 3.6.12, progress into mission, target a Jumpnode with 'Y' key. | ||||
Additional Information | ERROR: AddressSanitizer: global-buffer-overflow on address 0x000103b8a070 at pc 0x1020848a2 bp 0x7fff5fbfc2b0 sp 0x7fff5fbfc2a8 READ of size 4 at 0x000103b8a070 thread T0 #0 0x1020848a1 in ship_subsys_disrupted ship.cpp:8066 0000001 0x100a7a8b0 in hud_update_ship_status hudtargetbox.cpp:2052 0000002 0x100db2b5d in hud_update_frame hud.cpp:1605 0000003 0x1002ea391 in game_simulation_frame freespace.cpp:4025 0000004 0x1002eec01 in game_frame freespace.cpp:4380 0000005 0x1002f43eb in game_do_frame freespace.cpp:4791 0000006 0x1002fff4a in game_do_state freespace.cpp:6466 0000007 0x1008f18a9 in gameseq_process_events gamesequence.cpp:405 0000008 0x1003067c8 in game_main freespace.cpp:7033 0000009 0x100307e36 in SDL_main freespace.cpp:7167 0000010 0x1000027aa in -[SDLMain applicationDidFinishLaunching:] SDLMain.m:300 #11 0x7fff8ffe3ed9 in _CFXNotificationPost (in CoreFoundation) + 2553 0000012 0x7fff85fc6e25 in -[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation) + 63 0000013 0x7fff8b92855c in -[NSApplication _postDidFinishNotification] (in AppKit) + 291 0000014 0x7fff8b928295 in -[NSApplication _sendFinishLaunchingNotification] (in AppKit) + 215 0000015 0x7fff8b925481 in -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] (in AppKit) + 565 0000016 0x7fff8b92507b in -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] (in AppKit) + 350 0000017 0x7fff85fe070a in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] (in Foundation) + 307 0000018 0x7fff85fe056c in _NSAppleEventManagerGenericHandler (in Foundation) + 105 0000019 0x7fff8e3a9077 in aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) (in AE) + 306 0000020 0x7fff8e3a8ed8 in dispatchEventAndSendReply(AEDesc const*, AEDesc*) (in AE) + 36 0000021 0x7fff8e3a8d98 in aeProcessAppleEvent (in AE) + 317 0000022 0x7fff88b11708 in AEProcessAppleEvent (in HIToolbox) + 99 0000023 0x7fff8b921865 in _DPSNextEvent (in AppKit) + 1455 0000024 0x7fff8b920e21 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in AppKit) + 127 0000025 0x7fff8b9181d2 in -[NSApplication run] (in AppKit) + 516 0000026 0x1000048c3 in CustomApplicationMain SDLMain.m:227 0000027 0x100004340 in main SDLMain.m:377 0000028 0x100001513 in start (in FS2_Open (debug)) + 51 0000029 0x0 in 0x0 0x000103b8a070 is located 16 bytes to the left of global variable 'Dead_camera_pos' from 'fs2open/trunk/fs2_open/projects/Xcode4/../../code/ship/shiphit.cpp' (0x103b8a080) of size 12 'Dead_camera_pos' is ascii string '' 0x000103b8a070 is located 40 bytes to the right of global variable 'free_points' from 'fs2open/trunk/fs2_open/projects/Xcode4/../../code/render/3dclipper.cpp' (0x103b89f80) of size 200 Shadow bytes around the buggy address: 0x1000207713b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000207713c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 04 f9 f9 0x1000207713d0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 0x1000207713e0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 0x1000207713f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x100020771400: 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9[f9]f9 0x100020771410: 00 04 f9 f9 f9 f9 f9 f9 00 04 f9 f9 f9 f9 f9 f9 0x100020771420: 00 00 00 00 f9 f9 f9 f9 00 00 00 00 f9 f9 f9 f9 0x100020771430: 04 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00 0x100020771440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020771450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap righ redzone: fb Freed Heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 ASan internal: fe ==67297==ABORTING | ||||
Tags | No tags attached. | ||||
|
Extra validation checking committed in r9612. |
|
This bug is caused by the point to a ship structure *sp that is passed to the function being incorrect. |
|
Fix committed to trunk@9627. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-03-30 03:05 | Echelon9 | New Issue | |
2013-03-30 03:08 | Echelon9 | Steps to Reproduce Updated | |
2013-03-30 03:42 | Echelon9 | Note Added: 0014860 | |
2013-03-30 03:45 | Echelon9 | Status | new => confirmed |
2013-04-13 04:20 | Echelon9 | Description Updated | |
2013-04-13 04:20 | Echelon9 | Steps to Reproduce Updated | |
2013-04-13 04:21 | Echelon9 | Assigned To | => Echelon9 |
2013-04-13 04:21 | Echelon9 | Status | confirmed => assigned |
2013-04-13 04:26 | Echelon9 | Summary | AddressSanitizer: global-buffer-overflow in ship_subsys_disrupted() ship.cpp:8059 => AddressSanitizer: global-buffer-overflow in ship_subsys_disrupted() ship.cpp:8066 |
2013-04-13 04:26 | Echelon9 | Description Updated | |
2013-04-13 04:26 | Echelon9 | Additional Information Updated | |
2013-04-13 05:18 | Echelon9 | Note Added: 0014918 | |
2013-04-13 07:07 | Echelon9 | Changeset attached | => fs2open trunk r9627 |
2013-04-13 07:07 | Echelon9 | Note Added: 0014919 | |
2013-04-13 07:07 | Echelon9 | Status | assigned => resolved |
2013-04-13 07:07 | Echelon9 | Resolution | open => fixed |