2025-07-30 08:50 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001848Spring engineUnit Scriptingpublic2010-02-22 01:36
Reporterkmcguire 
Assigned Tohoijui 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionno change required 
Product Version0.81.1.3 
Target VersionFixed in Version 
Summary0001848: skirmishAiCallback_UnitDef_MoveData_* Access Violation
DescriptionClb_UnitDef_MoveData_getDepthMod, -- UnitDefId=316
Clb_UnitDef_MoveData_getMoveType, -- UnitDefId=316
Clb_UnitDef_MoveData_isSubMarine, -- UnitDefId=316

Loading an AI DLL (starting the game from the command line using spring.exe) and clicking the test button (at top) will produce a crash from an access violation. Somewhere inside skirmishAiCallback_UnitDef_MoveData_getTerrainClass a instruction tries to access memory that does not exist:

IF, you call the function with the arguments __stdcall(int32_t=1, int32_t=316).

This also happens with a few other functions and maybe others. This could be a problem on my machine, or a mistake that I am making.
Additional Information/*
        This should be sufficient to produce the crash.
*/
extern "C" __declspec(dllexport) int __stdcall init(int teamId, const struct SSkirmishAICallback* callback)
{
    callback->Clb_UnitDef_MoveData_isSubMarine(1, 316);
    return 0;
}


extern "C" int __declspec(dllexport) __stdcall handleEvent(int teamId, int topic, const void* data)
{
    return 0;
}
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • txt file icon infolog.txt (11,078 bytes) 2010-02-21 17:15 -
    LogOutput initialized.
    Spring 0.81.1.3 (0.81.1.3-0-g725801c{@}-cmake-mingw32)
    Build date/time: Jan 31 2010 17:44:33
    Available log subsystems: mapinfo, CollisionVolume, unit, VFS-detail, VFS, ArchiveScanner, Sound
    Enabled log subsystems: Sound
    Enable or disable log subsystems using the LogSubsystems configuration key
      or the SPRING_LOG_SUBSYSTEMS environment variable (both comma separated).
    default config file: C:\Users\Kevin\AppData\Local\springsettings.cfg
    using default configuration source "C:\Users\Kevin\AppData\Local\springsettings.cfg"
    [CMyMath::Init] CPU SSE mask: 888, flags:
    	SSE 1.0:  1,  SSE 2.0:  1
    	SSE 3.0:  1, SSSE 3.0:  0
    	SSE 4.1:  0,  SSE 4.2:  0
    	SSE 4.0A: 1,  SSE 5.0A: 0
    	using streflop SSE FP-math mode, CPU supports SSE instructions
    OS: Microsoft Windows
    Microsoft Windows Vista Home Basic Edition, 64-bit Service Pack 2 (build 6002)
    AMD Phenom(tm) 9550 Quad-Core Processor; 4094MB RAM, 8409MB pagefile
    OS: emulated 32bit mode
    Using read-write data directory: C:\Program Files (x86)\Spring Engine\
    Using read-only  data directory: C:\Users\Kevin\Documents\My Games\Spring\
    Scanning: C:\Users\Kevin\Documents\My Games\Spring\maps
    Scanning: C:\Users\Kevin\Documents\My Games\Spring\mods
    Scanning: C:\Program Files (x86)\Spring Engine\maps
    Scanning: C:\Program Files (x86)\Spring Engine\base
    Video mode set to  800 x 600 / 32 bit
    [      0] SDL:  1.2.10
    [      0] GL:   3.2.0
    [      0] GL:   NVIDIA Corporation
    [      0] GL:   GeForce 9800 GT/PCI/SSE2
    [      0] GLEW: 1.4.0
    [      0] Joysticks found: 0
    [      0] Joystick 0 not found
    [      0] Connecting to local server
    [      0] Starting GameServer: 93 ms
    [      0] Starting demo recording
    [      0] Using map Tabula-v2.smf
    [      0] Recording demo demos/20100221_101657_Tabula-v2_0.81.1.sdf
    [      0] Using script Skirmish AI test: McGuireAI 0.0.0
    [      0] Using mod Balanced Annihilation V7.11
    [      0] Sound: OpenAL info:
    [      0] Sound:   Vendor:     Creative Labs Inc.
    [      0] Sound:   Version:    1.1
    [      0] Sound:   Renderer:   Software
    [      0] Sound:   AL Extensions: EAX EAX2.0 EAX3.0 EAX4.0 EAX5.0 EAX3.0EMULATED EAX4.0EMULATED AL_EXT_OFFSET AL_EXT_LINEAR_DISTANCE AL_EXT_EXPONENT_DISTANCE
    [      0] Sound:   ALC Extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_EFX
    [      0] Sound:   Device:     Generic Software
    [      0] Sound:   Available Devices:  
    [      0] Sound:                       Generic Software
    [      0] Using mod archive BalancedAnnihilation.sd7
    [      0] Loading client data: 477 ms
    [      0] User number 0 (team 0, allyteam 0)
    [      0] Loading console: 21 ms
    [      0] Sound:  parsed 25 sounds from gamedata/sounds.lua
    [      0] Loading sounds: 31 ms
    [      0] Camera and mouse: 567 ms
    [      0] Parsing unit icons
    [      0] Parsing definitions
    [      0] Loading all definitions:  0.762000
    [      0] Loading defs: 1574 ms
    [      0] You are missing the "ARB_shadow_ambient" extension (this will probably make shadows darker than they should be)
    [      0] Loading map informations
    [      0] Loading map
    [      0] Loading Map
    [      0] Loading .smt tile-file "maps/Tabula-v2.smt"
    [      0] Loading 52057 tiles from file 1/1
    [      0] Reading tiles
    [      0] Reading tile map
    [      0] generating MipMaps: 10 ms
    [      0] Calculating smooth height mesh
    [      0] Calculating smooth mesh: 263 ms
    [      0] Creating projectile texture
    [      0] Number of damage types: 40
    [      0] Loading weapon definitions
    [      0] Loading unit definitions
    [      0] Loading feature definitions
    [      0] Creating unit textures
    [      0] Initializing map features
    [      0] Unknown map feature type 
    [      0] Reading estimate path costs
    [      0] Pathing data checksum: a9bf6db8
    [      0] Creating sky
    [      0] Loading LuaRules
    [      0] Loaded gadget:  No Self-D           <unit_prevent_share_selfd.lua>
    [      0] Loaded gadget:  AirPlantParents     <unit_air_plants.lua>
    [      0] Loaded gadget:  DirectControl       <unit_direct_control.lua>
    [      0] Loaded gadget:  DragonsDisguise     <unit_set_neutral.lua>
    [      0] Loaded gadget:  DroppedStartPos     <unit_fix_dropped_startpos.lua>
    [      0] Loaded gadget:  MissileControl      <unit_missile_delay.lua>
    [      0] Loaded gadget:  Napalm              <lups_napalm.lua>
    [      0] Loaded gadget:  No Land Damage      <unit_no_land_damage.lua>
    [      0] Loaded gadget:  No Self Pwn         <unit_noselfpwn.lua>
    [      0] Loaded gadget:  NoCost              <cmd_nocost.lua>
    [      0] Loaded gadget:  PassiveBuilders     <unit_passive_builders.lua>
    [      0] Loaded gadget:  Prevent Lab Hax     <unit_prevent_lab_hax.lua>
    [      0] Loaded gadget:  Prevent Load Hax    <unit_prevent_load_hax.lua>
    [      0] Loaded gadget:  Prevent Range Hax   <unit_prevent_range_hax.lua>
    [      0] Loaded gadget:  Prevent Strange Orders  <unit_prevent_strange_orders.lua>
    [      0] Loaded gadget:  Reclaim Fix         <unit_reclaim_fix.lua>
    [      0] Loaded gadget:  ShieldDrain         <unit_shield_watch.lua>
    [      0] Loaded gadget:  Shockwaves          <lups_shockwaves.lua>
    [      0] Loaded gadget:  Start Point Remover Gadget  <init_start_point_remover_gadget.lua>
    [      0] Loaded gadget:  fx_reclaim_shards   <fx_reclaim_shards.lua>
    [      0] Loaded gadget:  lups_wrapper.lua    <lups_wrapper.lua>
    [      0] Loaded gadget:  Area Attack         <areaattack.lua>
    [      0] Loaded gadget:  C Is For Control    <comiscontrol.lua>
    [      0] Loaded gadget:  Team Com Ends       <teamcomends.lua>
    [      0] Loaded gadget:  LupsSyncedManager   <lups_manager.lua>
    [      0] Loaded gadget:  Mex Upgrader Gadget  <unit_mex_upgrader.lua>
    [      0] Loaded gadget:  AirPlantParents     <unit_air_plants.lua>
    [      0] Loaded gadget:  DragonsDisguise     <unit_set_neutral.lua>
    [      0] Loaded gadget:  DroppedStartPos     <unit_fix_dropped_startpos.lua>
    [      0] Loaded gadget:  MissileControl      <unit_missile_delay.lua>
    [      0] Loaded gadget:  Napalm              <lups_napalm.lua>
    [      0] Loaded gadget:  NoCost              <cmd_nocost.lua>
    [      0] Loaded gadget:  PassiveBuilders     <unit_passive_builders.lua>
    [      0] Loaded gadget:  Reclaim Fix         <unit_reclaim_fix.lua>
    [      0] Loaded gadget:  ShieldDrain         <unit_shield_watch.lua>
    [      0] Loaded gadget:  Shockwaves          <lups_shockwaves.lua>
    [      0] Loaded gadget:  Start Point Remover Gadget  <init_start_point_remover_gadget.lua>
    [      0] Loaded gadget:  fx_reclaim_shards   <fx_reclaim_shards.lua>
    [      0] Loaded gadget:  mo_enemywrecks      <mo_enemywrecks.lua>
    [      0] Loaded gadget:  mo_greenfields      <mo_greenfields.lua>
    [      0] Loaded gadget:  mo_noowner          <mo_noowner.lua>
    [      0] Loaded gadget:  mo_noshare          <mo_noshare.lua>
    [      0] Loaded gadget:  mo_nowrecks         <mo_nowrecks.lua>
    [      0] Loaded gadget:  Area Attack         <areaattack.lua>
    [      0] Loaded gadget:  C Is For Control    <comiscontrol.lua>
    [      0] Loaded gadget:  LupsSyncedManager   <lups_manager.lua>
    [      0] Loaded gadget:  Mex Upgrader Gadget  <unit_mex_upgrader.lua>
    [      0] Loaded gadget:  Lups                <lups_wrapper.lua>
    [      0] Loading LuaGaia
    [      0] Loading LuaUI
    [      0] Using LUAUI_DIRNAME = LuaUI/
    [      0] Reloaded ctrlpanel with: LuaUI/ctrlpanel.txt
    [      0] LuaUI: bound F11 to the widget selector
    [      0] LuaUI: bound CTRL+F11 to tweak mode
    [      0] Loaded widget from mod:   Red_UI_Framework    <red_ui_framework.lua>
    [      0] Loaded widget from mod:   BlurApi             <api_gfx_blur.lua>
    [      0] Loaded widget from mod:   MexUpg Helper       <helper.lua>
    [      0] Loaded widget from mod:   Red Tooltip         <gui_red_tooltip.lua>
    [      0] Loaded widget from mod:   HealthBars          <unit_healthbars.lua>
    [      0] Loaded widget from mod:   Ally Resource Bars  <gui_ally_res.lua>
    [      0] Loaded widget from mod:   BuildETA            <gui_build_eta.lua>
    [      0] Loaded widget from mod:   Auto First Build Facing  <autofirstbuildfacing.lua>
    [      0] Loaded widget from mod:   Autoquit            <autoquit.lua>
    [      0] Loaded widget from mod:   Build Split         <cmd_buildsplit.lua>
    [      0] Loaded widget from mod:   CustomIcons         <unit_customicons.lua>
    [      0] Loaded widget from mod:   Defense Range       <gui_defenserange.lua>
    [      0] Loaded widget from mod:   Loop Select         <unit_loop_select.lua>
    [      0] Loaded widget from mod:   MohoExploiter       <unit_moho_exploiter.lua>
    [      0] Loaded widget from mod:   MoreSounds          <unit_more_sounds.lua>
    [      0] Loaded widget from mod:   GameTypeInfo        <gui_game_type_info.lua>
    [      0] Loaded widget from mod:   NoDuplicateOrders   <cmd_no_duplicate_orders.lua>
    [      0] Loaded widget from mod:   Pause Screen        <gui_pausescreen.lua>
    [      0] Loaded widget from mod:   Point Tracker       <gui_point_tracker.lua>
    [      0] Loaded widget from mod:   Ghost Site          <unit_ghostsite.lua>
    [      0] Loaded widget from mod:   ReclaimInfo         <gui_reclaiminfo.lua>
    [      0] Loaded widget from mod:   Share Tracker       <unit_share_tracker.lua>
    [      0] Loaded widget from mod:   Transporting        <gui_transporting.lua>
    [      0] Loaded widget from mod:   XrayHighlight       <gui_xray_highlight.lua>
    [      0] Loaded widget from mod:   Red_Drawing         <red_ui_framework_drawing.lua>
    [      0] Loaded widget from mod:   Red Build/Order Menu  <gui_red_buildordermenu.lua>
    [      0] Loaded widget from mod:   Red Console         <gui_red_console.lua>
    [      0] Loaded widget from mod:   Red Resource Bars   <gui_red_resourcebars.lua>
    [      0] Loaded widget from mod:   Take Reminder       <gui_take_remind.lua>
    [      0] Loaded widget from mod:   Attack AoE          <gui_attack_aoe.lua>
    [      0] Loaded widget from mod:   Red Minimap         <gui_red_minimap.lua>
    [      0] Loaded widget from mod:   BA Waypoint Dragger  <unit_waypoint_dragger_2.lua>
    [      0] Loaded widget from mod:   Select n Center!    <gui_center_n_select.lua>
    [      0] Loaded widget from mod:   LupsManager         <gfx_lups_manager.lua>
    [      0] Loaded widget from mod:   BA_AllyCursors      <gui_ba_ally_cursors.lua>
    [      0] Loaded widget from mod:   Lups                <lups_wrapper.lua>
    [      0] LolUI is now known as RedUI: if you prefer the old LolUI this can be downloaded to your local widgets
    [      0] Loaded widget from mod:   LolUI               <lolui.lua>
    [      0] Loaded widget from mod:   CustomFormations2   <unit_customformations2.lua>
    [      0] LuaUI v0.3
    [      0] Finalizing...
    [      0] Connection attempt from UnnamedPlayer
    [      0]  -> Version: 0.81.1.3 (0.81.1.3-0-g725801c{@}-cmake-mingw32)
    [      0]  -> connection established (given id 0)
    [      0] Player UnnamedPlayer finished loading and is now ingame
    [      0] GameID: 905c814b1b726d7c2941d67e09c7550c
    [      0] UnnamedPlayer added point: Start 0
    [      0] UnnamedPlayer added point: Start 1
    
    txt file icon infolog.txt (11,078 bytes) 2010-02-21 17:15 +

-Relationships
+Relationships

-Notes

~0004675

hoijui (reporter)

EXPORT(int) init(int teamId, const struct SSkirmishAICallback* callback)
{
    bool isMDAvail = callback->Clb_UnitDef_0AVAILABLE0MoveData(teamId, 316);
    if (isMDAvail) {
        callback->Clb_UnitDef_MoveData_getDepthMod(teamId, 316);
        callback->Clb_UnitDef_MoveData_getMoveType(teamId, 316);
        callback->Clb_UnitDef_MoveData_isSubMarine(teamId, 316);
    }
    return 0;
}

~0004676

kmcguire (reporter)

Thank you for the solution. The rest is for you guys to consider if it is a bug or not. I am okay either way. I got it figured out now.

~0004677

hoijui (reporter)

:-)
a crash through this can only be run into with a bug in an AI Interface or Wrapper (assuming nobody writes a pure C AI). runtime guarding against it would mean overhead (even doh little, of course).
i added assert(s) in the functions you mentioned (in pureint branch).
+Notes

-Issue History
Date Modified Username Field Change
2010-02-21 17:15 kmcguire New Issue
2010-02-21 17:15 kmcguire File Added: infolog.txt
2010-02-21 20:57 hoijui Note Added: 0004675
2010-02-21 23:11 kmcguire Note Added: 0004676
2010-02-22 01:36 hoijui Note Added: 0004677
2010-02-22 01:36 hoijui Status new => resolved
2010-02-22 01:36 hoijui Resolution open => no change required
2010-02-22 01:36 hoijui Assigned To => hoijui
+Issue History