mojira.dev
MC-306521

Extreme Yaw Rotation Causes Floating-Point Overflow, Resulting in Player Lock and Game Crash

概述

将视角旋转大约23,310圈后,视角值变得异常,锁定玩家的视角。继续输入会导致浮点精度损失,最终导致浮点溢出,使游戏崩溃。

实际结果

常见结果

  • View Offset: There is a significant discrepancy between where the player is looking and the actual view direction. In third-person perspective, the player model's orientation does not match the view direction. (Clearly visible in the video)

  • Movement Restriction: The player cannot move horizontally and can only perform jumping actions.

  • 服务器端:玩家不受击退影响;X和Z轴坐标完全锁定,即使被生物攻击,玩家的位置也不会改变。

  • 客户端:当玩家被击退时,客户端显示玩家在空中被击退(实际玩家位置与客户端显示位置不同),但从服务器的角度来看,玩家是完全固定的。这种现象类似于“离体体验”。

不同的结果(取决于复制方法)

  • Result 1: Due to floating-point precision issues, slowly moving the mouse does not rotate the view horizontally. Only rapid mouse movement produces changes, and only vertical view (pitch) movement is effective.

  • 结果 2:玩家可以自由旋转视角。

进一步测试

  • 持续以高速度向同一方向旋转可能导致浮点溢出和游戏崩溃。然而,由于浮点溢出不易触发,实际的崩溃相对较少。

  • 将鼠标向相反方向移动相同的距离可以解决此问题。(此错误可以使用外部工具轻松触发和修复。)

潜在影响

  • 破坏多人游戏平衡(在没有反作弊系统的服务器上):此漏洞可以使用外部程序轻松重现。

  • 可能会出现意外错误,包括游戏变得无响应。

受影响的测试环境

  • 单人模式

  • 多人模式

这个错误在受影响的测试环境中几乎100%可以重现。
这个问题可能会影响所有Minecraft版本。我测试的版本有:1.8.9, 1.16.5, 1.20.4, 和 1.21.1 — 所有版本都会触发这个问题。

重现步骤

  1. 我使用的C++源代码已附上。您可以自行编译和运行。这个程序只模拟鼠标移动,不包含恶意代码(code.cpp)。

  2. 观察以下现象:

    • 玩家无法移动

    • 玩家无法水平旋转视角(在某些Minecraft服务器上,视角仍然可以自由旋转)。

根本原因推测(个人意见)

  • When a float value exceeds 16,777,216, it begins to lose decimal precision.

  • 因为 16,777,216 ÷ 360 ≈ 46,603,旋转大约46,603次完整的圈会触发这个精度问题。

  • 如果旋转超过 200,000 圈,游戏可能会完全冻结并变得无响应,但不会自行崩溃。此过程只能通过任务管理器终止。

  • 这个值超过了浮点数可以精确表示的最大整数,导致严重的浮点精度损失,并引发上述异常现象。

预期结果

查看旋转(偏航/俯仰角度)和玩家移动应正常工作,不会出现数值溢出、冻结或游戏崩溃。

Attachments

Comments 2

Thank you for helping us improve Minecraft! We saved your files:

[media][media][media][media]

Hi!
Thank you for your report!
However, this issue is Invalid.

Your game, launcher or server is modified.
If you can reproduce the issue in a vanilla environment, please recreate the issue.

  • Any non-standard client/server/launcher build needs to be taken up with the appropriate team, not Mojang.

  • A world which had previously been opened with a modified client might be corrupted. Please try reproducing the issue in a newly generated world.

  • Any plugin issues need to be addressed to the creator of the plugin or resource pack.

  • If you have problems on large servers like Hypixel, please contact them first as they run modified server software.

Quick Links
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

COM1919

(Unassigned)

Unconfirmed

(Unassigned)

1.21.11

Retrieved