boostorg / boostorg/python

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

Abierto Apto para principiantes
#526 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
537
Forks
223
Merge medio
11 h 22 min
PR fusionados (30 d)
2

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
backend
Tipo de issue
Error
Dificultad
1/5
Tiempo estimado
Menos de una hora
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
84/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.