boostorg / boostorg/algorithm

boost::algorithm::split_regex hangs and consumes CPU on dangling alternatives

オープン
#68 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
131
フォーク
117
PR マージ指標
30日以内にマージされた PR はありません

説明

I happened to typo a regex, and I noticed that `boost::algorithm::split_regex` started consuming a bunch of CPU. I don't know is this would have eventually caught itself and terminating. The regex in question was `;|`, and this appears to be true for any dangling `|`.

I'm a bit surprised that `boost::regex` allowed `;|` as valid, given split_regex's behavior.

Simple example up at https://gist.github.com/directionless/c38eb7dc216bcd93b40c3ecaf99f326e

I tested this on darwin with boost 1.67, and on linux with boost 1.65

(This was moved here from https://github.com/boostorg/regex/issues/76)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、記載されている Boost 1.65 または 1.67 の環境を使い、リンク先の gist にある末尾の `;|` パターンを含む `split_regex` ケースを再現します。Boost のアルゴリズムと regex の動作まで呼び出しを追跡し、CPU 使用率が終了しない理由を特定します。報告された入力でハングしなくなり、その動作が回帰テストでカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。