mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #420] root_signature: guard u32 offset wrap in RTS0 constants and validate param type in pack_stage (RT-ROOTSIG-PARSE-PACK) #472
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#472
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/420
Author: @tahffo68hk-hash
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/rt-rootsig-parse-pack📝 Commits (1)
c7ff7f0root_signature: prevent u32 offset wrap in parse_rts0_payload and validate param type in pack_stage (RT-ROOTSIG-PARSE-PACK)📊 Changes
2 files changed (+38 additions, -5 deletions)
View changed files
📝
runtime/src/root_signature.cpp(+11 -5)📝
runtime/test/root_signature_test.cpp(+27 -0)📄 Description
Claimed in the coordination issue as:
RT-ROOTSIG-PARSE-PACKProblem
Two validation gaps in
runtime/src/root_signature.cpp:parse_rts0_payload(), theConstantsbranch computedpoff + 4andpoff + 8in 32-bituint32_t. A malformed RTS0 payload withpoff >= 0xFFFFFFFCwrappedpoff + 4/poff + 8to0/4instead of failing bounds checks, reading earlier header bytes (theTableandDescriptorbranches already promotedpofftosize_t).pack_stage()omitted theParamTypevalidity check thatpack()performs, silently accepting unknown parameter types and returningok = true.Fix
pofftosize_tbefore adding field offsets inparse_rts0_payload()(bothConstantsandDescriptorbranches).p.typeinpack_stage()identically topack().runtime/test/root_signature_test.cppcovering both cases.Verification
-DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF) on Windows 11.root_signature_test.exe-> exit code 0, 0 failures (no game files).中文翻译
在协调帖 #14 中认领的 ID:
RT-ROOTSIG-PARSE-PACK问题描述
runtime/src/root_signature.cpp存在两处校验缺陷:parse_rts0_payload()处理Constants参数时在 32 位uint32_t上计算poff + 4与poff + 8,当畸形 RTS0 载荷中poff >= 0xFFFFFFFC时会发生 32 位回绕,误读头部字节而非触发越界拦截。pack_stage()遗漏了pack()中的p.type合法性校验,对未知参数类型静默返回ok = true。修复方案
parse_rts0_payload()中先将poff提升为size_t再加字段偏移。pack_stage()中补齐与pack()一致的p.type校验。runtime/test/root_signature_test.cpp中补充两项回归测试。验证结果
root_signature_test.exe,0 失败(无游戏文件)。🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.