Closed vdemichev closed 2 months ago
Hi Michael,
First, many thanks for a fantastic library!
I found something which seems to cause a crash when processing certain .raw files. https://github.com/vdemichev/DiaNN/discussions/973
MSReader.cpp:
cRAW.getInstrument(&sInstrument[0]); cRAW.getManufacturer(&sManufacturer[0]);
RawReader.cpp:
void RAWReader::getInstrument(char* str){ strcpy(str,rawInstrument); }
sInstrument and sManufacturer are initialised with "unknown". What happens then if rawInstrument is longer than the capacity of sInstrument std::string?
I've so far applied a quick fix, adding this
sInstrument.reserve(512); sManufacturer.reserve(512);
after each occurrence of
sInstrument="unknown"; sManufacturer="unknown";
Seems to resolve the issue (no longer crashes), but I guess there is likely a better more elegant way to fix this.
Best, Vadim
Hi Vadim, Thanks for reporting the bug. Indeed, that is old, poorly written code. I'll have a fix in place soon. Cheers, Mike
Should be resolved now. Thanks again for reporting the issue!
Hi Michael,
First, many thanks for a fantastic library!
I found something which seems to cause a crash when processing certain .raw files. https://github.com/vdemichev/DiaNN/discussions/973
MSReader.cpp:
RawReader.cpp:
sInstrument and sManufacturer are initialised with "unknown". What happens then if rawInstrument is longer than the capacity of sInstrument std::string?
I've so far applied a quick fix, adding this
after each occurrence of
Seems to resolve the issue (no longer crashes), but I guess there is likely a better more elegant way to fix this.
Best, Vadim