Handle exceptions in VFS C API.

PiperOrigin-RevId: 817688877
Change-Id: Ia2e306fe4cd1848eb5731212aa4e959080a9d377
This commit is contained in:
Kyle Bayes
2025-10-10 10:02:44 -07:00
committed by Copybara-Service
parent b63252e4bb
commit 9e0885a4fa
2 changed files with 13 additions and 2 deletions
+7 -1
View File
@@ -1140,7 +1140,13 @@ std::vector<uint8_t> FileToMemory(const char* filename) {
return {};
}
std::vector<uint8_t> buffer(long_filesize);
std::vector<uint8_t> buffer;
try {
buffer.resize(long_filesize);
} catch (...) {
fclose(fp);
return {};
}
// go back to start of file
if (fseek(fp, 0, SEEK_SET) != 0) {