Crashes when the number of properties is less than what the header defines
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Start at the element-property loop that calls parseNext and inspect tokenSplit and parseNext together. Reproduce the supplied PLY example with fewer values than declared, then verify that the chosen bounds-checking behavior prevents an out-of-bounds access and handles the malformed row safely.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Properties are parsed with a loop that is repeated elem.properties.size() times, which is the number of properties the header says this element should have.
vector<string> tokens = tokenSplit(line);
size_t iTok = 0;
for (size_t iP = 0; iP < elem.properties.size(); iP++) {
elem.properties[iP]->parseNext(tokens, iTok);
}
However if this element has less properties than the header defines, tokenSplit(line) returns a number of tokens less than elem.properties.size().
Then when we call parseNext, tokens[curEntry] is an out-of-bounds access and we crash when trying to create an istringstream from whatever garbage we read.
virtual void parseNext(const std::vector<std::string>& tokens, size_t& currEntry) override {
data.emplace_back();
std::istringstream iss(tokens[currEntry]);
typename SerializeType<T>::type tmp; // usually the same type as T
iss >> tmp;
data.back() = tmp;
currEntry++;
};
Here is an example file that will cause a crash:
ply
format ascii 1.0
element vertex 1
property float x
property float y
property char z
comment There are 3 properties but we provide only 2!
end_header
3 4
Possible fixes:
- Verify that the number of tokens matches the expected number of properties
- In
parseNext, ensure thatcurrEntryis withintokens.size() - In
parseNext, usetokens.at(currEntry)
- Lenguaje dominante
- C++
- Estrellas
- 406
- Forks
- 74
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nmwsharp/happly
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
Todos los issues de nmwsharp/happly
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
google/libultrahdr#485 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
godotengine/godot#123776 ·
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 60/100
-
good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
ros2/common_interfaces#344 ·