Crashes when the number of properties is less than what the header defines
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
- Lingua principale
- C++
- Stelle
- 406
- Fork
- 74
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nmwsharp/happly
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
Tutte le issue di nmwsharp/happly
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Component: GLib
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Mute ydb/tests/functional/dstool/test_canonical_requests.py.Test.test_group_take_snapshot in main Apertaai_reviewed
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ydb-platform/ydb#53974 · 3 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
google/libultrahdr#485 ·