boostorg / boostorg/python

numpy::from_data calls vector::front and crashes (or has UB) when called with a scalar object

Aberta Para iniciantes
#526 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C++
Estrelas
537
Forks
223
Merge médio
11h 22min
PRs com merge (30d)
2

Descrição

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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
cpp
Domínio
backend
Tipo de issue
Bug
Dificuldade
1/5
Tempo estimado
Menos de uma hora
Status de atividade
Pouca atividade
Clareza
Claramente especificada
Facilidade para iniciantes
84/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.