From 28b359703ded5700666083c94559627709cf73ee Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 23 Feb 2017 15:05:36 +0100 Subject: [PATCH] ram_fs: avoid Deref_unconstructed_object exception if ROM is invalid. With the patch one gets a name of the ROM and the server continues. --- repos/os/src/server/ram_fs/main.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repos/os/src/server/ram_fs/main.cc b/repos/os/src/server/ram_fs/main.cc index a59f6e6b1d..89a4cc01f5 100644 --- a/repos/os/src/server/ram_fs/main.cc +++ b/repos/os/src/server/ram_fs/main.cc @@ -18,7 +18,6 @@ #include #include #include -#include #include /* local includes */ @@ -619,6 +618,9 @@ static void preload_content(Genode::Env &env, /* read file content from ROM module */ try { Attached_rom_dataspace rom(env, name); + if (!rom.valid()) + throw Rm_session::Attach_failed(); + File *file = new (&alloc) File(alloc, as); file->write(rom.local_addr(), rom.size(), 0); dir.adopt_unsynchronized(file);