numpy::from_data calls vector::front and crashes (or has UB) when called with a scalar object
- 主要言語
- C++
- スター
- 537
- フォーク
- 223
- 平均マージ
- 11時間 22分
- マージ済み PR(30日)
- 2
説明
In ndarray.cpp, the function `from_data_impl` calls `&shape.front()` and `&strides.front()` for possibly empty vectors. This is, at best, undefined behavior. At worst, it triggers a crash (observed on Redhat/rocky 8&9, where I'm assuming boost::python packages were built with `-D_GLIBCXX_DEBUG`).
RECOMMEND: change `&vec.front()` to `vec.data()` to avoid UB and potential crashes.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start in ndarray.cpp at from_data_impl, where shape.front() and strides.front() are used for potentially empty vectors. Reproduce or inspect the scalar-object path and verify that it no longer performs invalid access or crashes; run the repository’s relevant existing tests if available. Done means scalar from_data calls work without undefined behavior or the reported crash.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 活発さ
- 静か
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 84/100