Fix crash in parse_date_id triggered by certain ID field patterns#1588
Merged
Fix crash in parse_date_id triggered by certain ID field patterns#1588
Conversation
日付・ID解析処理で特定の入力によりクラッシュする問題を修正します ID判定で文字列のインデックスアクセスを行っていたため、 特定の形式の入力において `std::string_view` の範囲外アクセスが発生し、 アサーション失敗により異常終了する場合がありました。 ID判定を `std::string_view::compare()` を用いた安全な比較に変更し、 範囲外アクセスを防止します。 この問題は @mtasaka さんにより報告および修正案が提示されました。 ご協力ありがとうございます。 --- Fix a crash caused by out-of-bounds access in ID parsing. The previous implementation accessed `string_view` by index when checking for "ID". Under certain input patterns, this could lead to an out-of-bounds access and trigger a `std::string_view` assertion failure. Replace the check with `std::string_view::compare()` to ensure safe substring comparison. Reported and patch suggested by @mtasaka. 修正にあたり不具合報告をしていただきありがとうございました。 Ref: #1587 Ref: https://mao.5ch.io/test/read.cgi/linux/1764825297/495-513n Co-authored-by: Mamoru TASAKA <mtasaka@fedoraproject.org>
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.
日付・ID解析処理で特定の入力によりクラッシュする問題を修正します
ID判定で文字列のインデックスアクセスを行っていたため、
特定の形式の入力において
std::string_viewの範囲外アクセスが発生し、アサーション失敗により異常終了する場合がありました。
ID判定を
std::string_view::compare()を用いた安全な比較に変更し、範囲外アクセスを防止します。
この問題は @mtasaka さんにより報告および修正案が提示されました。
ご協力ありがとうございます。
Fix a crash caused by out-of-bounds access in ID parsing.
The previous implementation accessed
string_viewby index whenchecking for "ID". Under certain input patterns, this could lead
to an out-of-bounds access and trigger a
std::string_viewassertionfailure.
Replace the check with
std::string_view::compare()to ensure safesubstring comparison.
Reported and patch suggested by @mtasaka.
修正にあたり不具合報告をしていただきありがとうございました。
Ref: #1587
Ref: https://mao.5ch.io/test/read.cgi/linux/1764825297/495-513n