Release v1.0.2 - #11
Merged
Merged
Conversation
- SAZ2 自己対局データの policy prior 合計検証で u32 が桁溢れし、偽造 chunk が 受理される問題を修正 - overflow-checks が無効な release build で検証を通過していた(debug build では 同じ入力が panic) - SAZ2 の wire format と public API は変更なし
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.
SAZ2 自己対局データの codec にあった桁溢れバグの修正リリース。
修正内容
SAZ2 の policy
priorは合計が 65535 に一致することを要求するが、encoder と decoder のどちらも合計をu32に積み上げて比較していた。65535 × 65537 = u32::MAXちょうどという関係から、policy entry 65539 件で真の合計を2^32 + 65535にするとu32がラップして偽の合計 65535 が成立する。[profile.release]はoverflow-checksを設定しておらず release では既定の false のため、偽造 chunk がOkで受理される。debug build では同じ入力が加算で panic するため、信頼できない入力での可用性の問題でもある。いずれも実機で再現を確認した。合計の積み上げをやめ、65535 を初期残余として
checked_subで引くPriorBudgetに置き換えた。超過はその場で捉えられ、桁溢れが原理的に起きない。encoder と decoder が同じ型を経由するため、同じ検証が 2 箇所に独立して存在する状態も解消している。互換性
SAZ2 の wire format と public API は変更なし。これまで有効だった chunk はそのまま有効で、出力バイト列も同一。影響を受けるのは不正な入力だけ。
検証
make check全通過