Crash with the ordinal indicators `º`/`ª` in `mi`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
src/canonicalize.rs の split_apart_pseudo_scripts と、失敗すると報告された MathML の例から始めてください。issue には、1 文字の識別子に対するガードの提案と、pseudo_script_single_char_mi という名前の回帰テストが含まれています。修正を確認するために cargo test を実行してください。例でクラッシュが起きなくなり、回帰テストが成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
In Spanish, ordinals are written with a period and the ordinal indicator: 1.º, 2.ª (U+00BA, U+00AA; not the degree sign). When the indicator comes as an mi on its own, MathCAT crashes, in any language:
<math><mn>1</mn><mo>.</mo><mi>º</mi></math>
<math><mn>1.</mn><mi>º</mi></math>
<math><mn>2</mn><mo>.</mo><mi>ª</mi></math>
All give index out of bounds at src/canonicalize.rs:404.
Cause and proposed patch: split_apart_pseudo_scripts pairs each char with the next one, so a single char gives no pairs and replace_children is called with an empty list. Tested: cargo test passes; adds the test pseudo_script_single_char_mi.
diff --git a/src/canonicalize.rs b/src/canonicalize.rs
index 1e3936f8..00a5165b 100644
--- a/src/canonicalize.rs
+++ b/src/canonicalize.rs
@@ -1520,7 +1520,8 @@ impl CanonicalizeContext {
let text = as_text(mi);
// debug!("split_apart_pseudo_scripts: start text=\"{text}\"");
- if !text.chars().any(is_pseudo_script_char) || IS_DEGREES_C_OR_F.is_match(as_str!(text)) {
+ if !text.chars().any(is_pseudo_script_char) || IS_DEGREES_C_OR_F.is_match(as_str!(text)) ||
+ text.chars().nth(1).is_none() { // a single char (e.g., "º") has nothing to split
return None;
}
@@ -7085,6 +7086,14 @@ mod canonicalize_tests {
are_strs_canonically_equal_result(test_str, target_str, &[])
}
+ #[test]
+ fn pseudo_script_single_char_mi() -> Result<()> {
+ // used to crash (index out of bounds in replace_children)
+ let test_str = "<math><mn>1</mn><mi>º</mi></math>";
+ let target_str = "<math><mrow data-changed='added'><mn>1</mn><mo data-changed='added'>⁢</mo><mi>º</mi></mrow></math>";
+ are_strs_canonically_equal_result(test_str, target_str, &[])
+ }
+
#[test]
fn prescript_only() -> Result<()> {
let test_str = "<math><msub><mtext/><mn>92</mn></msub><mi>U</mi></math>";
- 主要言語
- Rust
- スター
- 130
- フォーク
- 96
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 84
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
daisy/MathCAT のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
daisy/MathCAT#946 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
discussion
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
discussion translation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
daisy/MathCAT#675 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
feature request for vector from O to A再び着手できるかも @moritz-gross が 52 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement good first issue rules rust
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
daisy/MathCAT#621 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
Panic on live viewport resize when unstyled elements exist in display: none subtree対応中かも @GoCoder7 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DioxusLabs/blitz#1488 ·
メンテナーはふだん 1 日以内に返信
-
🏷️ good first issue enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
S-Needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
vectordotdev/vrl#2042 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信