Repository navigation
Conversation
MSVC lays out overloaded virtuals in reverse declaration order, which is why every other overload pair in this header is declared in reverse slot order. The CreateObject pair was declared in slot order, so CreateObject(name, obj) compiled to slot 0x16, which in 1.11.240 is CreateObject(name, properties, obj) (0x2119990), while the two-argument overload is slot 0x17 (0x2119930: mov r9, r8; xor r8d, r8d; call [rax+48h]). PackVariable reaches it for any form with no bound script object, and the engine then reads the garbage out-pointer and crashes at Fallout4.exe+0x211edd0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ejams1
marked this pull request as ready for review
October 3, 2026 00:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IVirtualMachinedeclares its twoCreateObjectoverloads in slot order (properties overload, slot 0x16, then the two-argument one, slot 0x17). MSVC lays out overloaded virtuals in reverse declaration order, which is why every other overload pair in this header (GetScriptObjectType,GetScriptObjectTypeNoLoad,CreateArray,SetCallableFromTasklets,GetVariableValue,DispatchMethodCall) is declared in reverse slot order. Because this pair is not,vm->CreateObject(name, obj)compiles to vtable +0xB0, and on 1.11.240 that slot is the properties overload.What the 1.11.240 vtable (
BSScript::Internal::VirtualMachine, ID 614600) holds:0x2119990:CreateObject(name, properties, obj). It computes a property count from the map and callsCreateObjectWithProperties([rax+48h]).0x2119930:CreateObject(name, obj), which ismov r9, r8; xor r8d, r8d; call [rax+48h].How it shows up.
PackVariablefor a form callsCreateObject(typeInfo->name, object)(BSScriptUtil.h:549) when the form has no bound script object yet. The call lands in the properties overload, which treats theBSTSmartPointer<Object>&as a property map and passes a garbage out-pointer down. The game then crashes reading it atFallout4.exe+0x211edd0. We hit this in a plugin dispatchingDispatchStaticCall<Actor*, AlchemyItem*>; a full dump shows the call at +0xB0 and the badr9. After this change the three call sites in that plugin compile to +0xB8.The fix swaps the two declarations. The slot comments stay with their functions.