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

WrapOperation checkArgumentCount can fail with null argument #97

Open
tesselslate opened this issue Nov 13, 2024 · 0 comments
Open

WrapOperation checkArgumentCount can fail with null argument #97

tesselslate opened this issue Nov 13, 2024 · 0 comments

Comments

@tesselslate
Copy link

If you pass the wrong number of arguments to Operation<?>.call() and one of the arguments is null, a NullPointerException is raised instead of an IncorrectArgumentCountException due to calling getClass() on a null Object.

Example:

@WrapOperation(at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/cull/graph/ChunkGraphIterationQueue;add(Lme/jellysquid/mods/sodium/client/render/chunk/cull/graph/ChunkGraphNode;Lnet/minecraft/util/math/Direction;)V", remap = false), method = "initSearch(Lnet/minecraft/client/render/Camera;Lme/jellysquid/mods/sodium/client/util/math/FrustumExtended;IZ)V", remap = true)
private void initSearch_markVisible(ChunkGraphIterationQueue queue, ChunkGraphNode node, Direction direction,
        Operation<Void> original) {
    // omit the queue argument to cause the argument count check to fail
    // direction will always be null, causing an NPE
    original.call(node, direction);
}
---- Minecraft Crash Report ----
// You're mean.

Time: 11/12/24, 8:15 PM
Description: Unexpected error

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "it" is null
        at knot//com.llamalad7.mixinextras.injector.wrapoperation.WrapOperationRuntime.lambda$checkArgumentCount$0(WrapOperationRuntime.java:14)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at knot//com.llamalad7.mixinextras.injector.wrapoperation.WrapOperationRuntime.checkArgumentCount(WrapOperationRuntime.java:14)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.cull.graph.ChunkGraphCuller.mixinextras$bridge$add$21(ChunkGraphCuller.java)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.cull.graph.ChunkGraphCuller.wrapOperation$zcd000$pastry$initSearch_markVisible(ChunkGraphCuller.java:551)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.cull.graph.ChunkGraphCuller.initSearch(ChunkGraphCuller.java:108)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.cull.graph.ChunkGraphCuller.computeVisible(ChunkGraphCuller.java:42)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.ChunkRenderManager.iterateChunks(ChunkRenderManager.java:153)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.ChunkRenderManager.update(ChunkRenderManager.java:123)
        at knot//me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.updateChunks(SodiumWorldRenderer.java:189)
        at knot//net.minecraft.client.render.WorldRenderer.setupTerrain(WorldRenderer.java:4168)
        at knot//net.minecraft.client.render.WorldRenderer.render(WorldRenderer.java:1107)
        at knot//net.minecraft.client.render.GameRenderer.renderWorld(GameRenderer.java:717)
        at knot//net.minecraft.client.render.GameRenderer.render(GameRenderer.java:540)
        at knot//net.minecraft.client.MinecraftClient.render(MinecraftClient.java:1021)
        at knot//net.minecraft.client.MinecraftClient.run(MinecraftClient.java:654)
        at knot//net.minecraft.client.main.Main.main(Main.java:215)
        at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480)
        at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
        at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
        at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
        at knot//com.llamalad7.mixinextras.injector.wrapoperation.WrapOperationRuntime.lambda$checkArgumentCount$0(WrapOperationRuntime.java:14)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at knot//com.llamalad7.mixinextras.injector.wrapoperation.WrapOperationRuntime.checkArgumentCount(WrapOperationRuntime.java:14)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.cull.graph.ChunkGraphCuller.mixinextras$bridge$add$21(ChunkGraphCuller.java)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.cull.graph.ChunkGraphCuller.wrapOperation$zcd000$pastry$initSearch_markVisible(ChunkGraphCuller.java:551)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.cull.graph.ChunkGraphCuller.initSearch(ChunkGraphCuller.java:108)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.cull.graph.ChunkGraphCuller.computeVisible(ChunkGraphCuller.java:42)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.ChunkRenderManager.iterateChunks(ChunkRenderManager.java:153)
        at knot//me.jellysquid.mods.sodium.client.render.chunk.ChunkRenderManager.update(ChunkRenderManager.java:123)
        at knot//me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.updateChunks(SodiumWorldRenderer.java:189)
        at knot//net.minecraft.client.render.WorldRenderer.setupTerrain(WorldRenderer.java:4168)
        at knot//net.minecraft.client.render.WorldRenderer.render(WorldRenderer.java:1107)
        at knot//net.minecraft.client.render.GameRenderer.renderWorld(GameRenderer.java:717)
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

1 participant