Repository navigation
Source Generated RegEx - #24
Merged
Merged
Conversation
Collaborator
|
Very nice PR!!! |
1llum1n4t1s
pushed a commit
to 1llum1n4t1s/Komorebi
that referenced
this pull request
May 16, 2026
#5 sourcegit-org#24) ## #5 GCHandle.Alloc(Pinned) で配列を明示的に pin (P0) DecodeWithStbImage / DecodeWithPfim の両方で Marshal.UnsafeAddrOfPinnedArrayElement を 使っていたが、MSDN 明記の通り **このメソッドは pin しない**。GC が配列を移動した直後に Bitmap ctor が古いアドレスを参照すると AccessViolationException (AV) のリスク。 GCHandle.Alloc(data, GCHandleType.Pinned) で明示的に pin → try/finally で Free() を保証。 Avalonia Bitmap ctor が同期コピーするので Free 後にアクセスされる経路はない (現状は動作するが API 契約違反だったため将来の .NET ランタイム最適化変更でサイレントに壊れる経路を遮断)。 ## sourcegit-org#24 DecodeWithPfim / DecodeWithTiff の int オーバーフローガード (P1) 悪意 TGA/DDS/TIFF ヘッダで `width * 4` や `width * height` の int オーバーフローが起きて 負値 stride で AV、または極小配列確保後の範囲外書き込みでメモリ破壊する経路を遮断。 DecodeWithStbImage は前回 /rere P0#4 で既にガード追加済 (対称化)。 - Pfim: `width * 4 > int.MaxValue` または `width * height * 4 > 1GB` で弾く - Tiff: `width * height > 256M` (1GB / 4byte) で弾く
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.
RegEx changed to Source Generated to improve perfomance: