Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal CLR error caused by LoadObject/LoadAllObjects #144

Open
jordan-dalby opened this issue Jun 5, 2024 · 9 comments
Open

Internal CLR error caused by LoadObject/LoadAllObjects #144

jordan-dalby opened this issue Jun 5, 2024 · 9 comments

Comments

@jordan-dalby
Copy link

jordan-dalby commented Jun 5, 2024

The following example provides all of the files needed to recreate the issue described in the title and below:
With some .uasset files, calling LoadObject or LoadAllObjects will give an output that, when accessed in any way, will crash the program, this behaviour is also seen in fmodel.
Minimal reproduceable example is attached.

const string objectPath = @"ShooterGame/Content/Mods/CrystalIsles/Assets/Environment/IsoStorage/Swamp/BogMyrtleBush_01/BogMyrtleBush_01";
const string objectName = @"BogMyrtleBush_01";

const string path = @"C:\Users\jorda\Desktop\CSMDE";

AbstractVfsFileProvider provider = new DefaultFileProvider(directory: path, searchOption: SearchOption.AllDirectories, isCaseInsensitive: true, versions: new VersionContainer(EGame.GAME_UE5_0));
provider.Initialize();
provider.Mount();

var export = provider.LoadObject(objectPath + "." + objectName);
Console.WriteLine(export.ExportType); // crash happens here

Alternatively, load the attached zip into fmodel.
I will note that this is for ARK Survival Ascended, which uses UE5_0.

The full error given is this:
Fatal error. Internal CLR error. (0x80131506)

The other files are far too big to be uploaded on GitHub so I've uploaded them to Dropbox: https://www.dropbox.com/scl/fi/i2cjcu3jv5i4mlnrsiql2/CSMDE.zip?rlkey=ub3sxq2sjpcnzbb0n99niju0h&st=8czfefoi&dl=0

If instead you own and have installed ARK Ascended, you can use those files instead, just find the same path as in the code snippet with fmodel.

@frarees
Copy link

frarees commented Jun 11, 2024

I'm experiencing similar issues on PUBG (UE 4.16.3) on specific assets e.g., SpikeTrap_16Jnts_Spikes_mesh_v2.uasset.

I'm using the nuget package (v1.1.1). And .NET 8.0 (SDK 8.0.301).

@lihaohong6
Copy link

lihaohong6 commented Aug 11, 2024

Same here. Game is Strinova (UE 4.28) and certain assets would crash FModel and leave CUE4Parse with an internal CLR error when calling LoadObject.

Using CUE4Parse 1.1.1 and .NET 8.0 (8.0.303). I tried downgrading CUE4Parse all the way to 1.0.5 (the earliest version to support UE 4.28), but the problem persists. Same thing happens after downgrading .NET to 8.0.100.

@lihaohong6
Copy link

I ran through a debugger. The error occurs at line 576 of AbstractFileProvider.cs.

return new Package(uasset, uexp, ubulk, uptnl, this, MappingsForGame, UseLazySerialization);

The Package object can be successfully constructed, but somehow the error pops up at this return step.

@4sval
Copy link
Collaborator

4sval commented Aug 12, 2024

games on 4.28 don't exist
use the correct ue version

@lihaohong6
Copy link

games on 4.28 don't exist use the correct ue version

Changed the UE version to 4.25, which is the version in the game executable. Problem still persists.

It's pretty unlikely that the UE version is the root cause since the Internal CLR error only occurs for a few dozen files among more than 180,000 that are exported.

@lihaohong6
Copy link

I tried unpacking the files uploaded by @jordan-dalby in FModel and I reproduced the error. Simply trying to open ShooterGame/Content/Mods/CrystalIsles/Assets/Environment/IsoStorage/Swamp/BogMyrtleBush_01/BogMyrtleBush_01 in FModel will crash the entire program, while all of the other 7 files in that directory can be opened in FModel normally. This is pretty much my experience: everything works alright except for a few files which consistently crash the program.

Even if the version of UE is somehow not correct, an attempt to unpack should not crash the entire program without even an exception being thrown. This Internal CLR error is quite cryptic, though, and I'm not sure if this is a Microsoft bug (there were some reports of OS updates and .NET updates fixing this error) or a rare issue in the unpacking code.

@jordan-dalby
Copy link
Author

games on 4.28 don't exist use the correct ue version

This issue is not exclusive to a specific version. I tested all of the UE5 versions that CUE4Parse offers to check this very thing. As @lihaohong6 has mentioned, this issue is also present in FModel, crashing the application when trying to view the "faulty" files.

@hallipr
Copy link
Contributor

hallipr commented Aug 26, 2024

I save the name of the file I'm parsing to file, then collect the name if the process dies while parsing. It appears to happen only with foliage related assets. I've saved this list to a file called broken.txt and just avoid processing them:

ShooterGame/Content/Genesis/Environment/Ocean/Vegetation/Coral/OceanLight01/SM_OceanLight01A.uasset
ShooterGame/Content/Genesis/Environment/Volcano/Vegitation/Foliage/BurntBush/BurntBush01.uasset
ShooterGame/Content/Genesis2/Structures/PlantSpeciesR/Structure_PlantSpeciesR_PrimeMeat.uasset
ShooterGame/Content/Mods/CrystalIsles/Assets/Environment/IsoStorage/Swamp/BogMyrtleBush_01/BogMyrtleBush_01.uasset
ShooterGame/Content/Mods/TheCenter/Assets/Meshes/Alpha_Roots2.uasset
ShooterGame/Content/Mods/TheCenter/Assets/Meshes/Myatlik2.uasset
ShooterGame/Content/PrimalEarth/Environment/DragonBoss_Arena/Trees/BurnedTrees/SM_BurnedTree_01.uasset
ShooterGame/Content/PrimalEarth/Environment/Jungle/Vegetation/Foliage/Plant03/Plant03_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/Jungle/Vegetation/Foliage/Plant04/Plant04_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/Jungle/Vegetation/Trees/BananaTree/BananaTree_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/Jungle/Vegetation/Trees/BigPalm/BigPalm_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/Jungle/Vegetation/Trees/ChineseBanyan_02/ChineseBanyan_02.uasset
ShooterGame/Content/PrimalEarth/Environment/Jungle/Vegetation/Trees/Kapok_04/Kapok_04.uasset
ShooterGame/Content/PrimalEarth/Environment/Jungle/Vegetation/Trees/Kapok/Kapok_03.uasset
ShooterGame/Content/PrimalEarth/Environment/Mountain/Vegetation/Trees/RainbowGum_01/RainbowGum_01.uasset
ShooterGame/Content/PrimalEarth/Environment/Shared/Vegetation/Foliage/ElephantGrass/ElephantGrass.uasset
ShooterGame/Content/PrimalEarth/Environment/Shared/Vegetation/Foliage/Knapweed/Knapweed.uasset
ShooterGame/Content/PrimalEarth/Environment/Shared/Vegetation/Foliage/WaterLillies/WaterLillies.uasset
ShooterGame/Content/PrimalEarth/Environment/Shared/Vegetation/Trees/Acacia/Acacia_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/Shared/Vegetation/Trees/BigFrond/BigFrond_Tree_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/Shared/Vegetation/WaterPlants/AmazonSword/AmazonSword.uasset
ShooterGame/Content/PrimalEarth/Environment/Snow/Vegetation/Foliage/SnowBamboo/SnowBamboo_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/Snow/Vegetation/Trees/CanopyMed_Tree/CanopyMed_Tree.uasset
ShooterGame/Content/PrimalEarth/Environment/Snow/Vegetation/Trees/DeadPines/DeadPine_03.uasset
ShooterGame/Content/PrimalEarth/Environment/Snow/Vegetation/Trees/Fir_Snow/Fir_Snow.uasset
ShooterGame/Content/PrimalEarth/Environment/Snow/Vegetation/Trees/SnowPalm/Snow_Palm.uasset
ShooterGame/Content/PrimalEarth/Environment/Swamp/Vegetation/Trees/Mangrove/Mangrove.uasset
ShooterGame/Content/PrimalEarth/Environment/Swamp/Vegetation/Trees/PondCypress/PondCypress_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/SwampCave/Vegetation/Foliage/WallFungus/WallFungus_Green_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/SwampCave/Vegetation/Foliage/WallFungus/WallFungus_Pink_SM.uasset
ShooterGame/Content/PrimalEarth/Environment/UnderWater/Meshes/Seaweed/SeaWeed03.uasset
ShooterGame/Content/PrimalEarth/Environment/UnderWater/Meshes/Seaweed/SeaWeed05.uasset
ShooterGame/Content/PrimalEarth/Items/Carrot/CarrotMedium_SM.uasset
ShooterGame/Content/PrimalEarth/Items/Citronal/CitronalSmall_SM.uasset
ShooterGame/Content/PrimalEarth/Items/Potato/PotatoPlantSmall_SM.uasset
ShooterGame/Content/ScorchedEarth/Environment/Canyons/Vegetation/Foliage/Marigold/SM_Marigold.uasset
ShooterGame/Content/ScorchedEarth/Environment/DragonTrench/burnedtree/SM_BurnedTree_SE.uasset
ShooterGame/Content/ScorchedEarth/Environment/HighDesert/Vegetation/Trees/JoshuaTree/JoshuaTree_SM.uasset
ShooterGame/Content/ScorchedEarth/Environment/HighDesert/Vegetation/Trees/PaloVerde/PaloVerde_2.uasset
ShooterGame/Content/ScorchedEarth/Environment/Mountains/Vegetation/Trees/Ironwood/SM_IronWood.uasset
ShooterGame/Content/ScorchedEarth/Environment/Shared/Vegetation/Foliage/AgaveFern/AgaveFern_B.uasset
ShooterGame/Content/ScorchedEarth/Environment/Shared/Vegetation/Foliage/Creosote/CreosoteBush_Ground_Cover.uasset
ShooterGame/Content/ScorchedEarth/Environment/Shared/Vegetation/Foliage/SaguaroCactus/SM_Saguaro_1.uasset
ShooterGame/Content/ScorchedEarth/Environment/Shared/Vegetation/Foliage/SandGrass/ClutterSandGrass_01.uasset
ShooterGame/Content/ScorchedEarth/Environment/Shared/Vegetation/Foliage/Yucca/SM_Yucca_Flowered.uasset
ShooterGame/Content/ScorchedEarth/Environment/Shared/Vegetation/Foliage/Yucca/SM_Yucca_Flowerless.uasset

@hallipr
Copy link
Contributor

hallipr commented Aug 26, 2024

It looks like the issue is with nanite resource parsing:
https://github.com/FabianFG/CUE4Parse/blob/master/CUE4Parse/UE4/Assets/Exports/Nanite/NaniteResources.cs#L357

            var nanite = new FByteArchive("PackedCluster", Ar.ReadArray<byte>(), Ar.Versions);

In SM_OceanLight01A.uasset the length for the array is read as 1073741824 and the FByteArchive has a Length of 119926

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants